diff --git a/src/Formatter/EGFormatter.php b/src/Formatter/EGFormatter.php index ecbf988..afecae8 100644 --- a/src/Formatter/EGFormatter.php +++ b/src/Formatter/EGFormatter.php @@ -9,10 +9,11 @@ /** * Validates and formats postcodes in Egypt. * - * Postcodes consist of 5 digits, without separator. + * Postcodes consist of 5 or 7 digits, without separator. * * @see https://en.wikipedia.org/wiki/List_of_postal_codes * @see https://en.wikipedia.org/wiki/List_of_postal_codes_in_Egypt + * @see https://www.upu.int/UPU/media/upu/PostalEntitiesFiles/addressingUnit/egyEn.pdf */ class EGFormatter implements CountryPostcodeFormatter { @@ -21,7 +22,7 @@ class EGFormatter implements CountryPostcodeFormatter */ public function format(string $postcode) : ?string { - if (preg_match('/^[0-9]{5}$/', $postcode) !== 1) { + if (preg_match('/^\d{5}(\d{2})?$/', $postcode) !== 1) { return null; }