Skip to content

Commit

Permalink
Merge pull request #18 from crazyfactory/allow_hyphen_default_format
Browse files Browse the repository at this point in the history
fix: allow "-" for default format
  • Loading branch information
turbo8p authored Sep 16, 2021
2 parents b22bc4a + 60d91ee commit 8943ca9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/ZipCode/Validator.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class Validator
'CY' => '[1-9]\\d{3}',
'CZ' => '\\d{3}\\s\\d{2}',
'DE' => '[0-9]{5}',
'DEFAULT' => '[0-9A-Z]{1,10}',
'DEFAULT' => '[0-9A-Z\-]{1,10}',
'DK' => '\\d{4}',
'EE' => '[1-9]{1}[0-9]{4}',
'ES' => '(AD{0,1}\\d{3})|\\d{5}',
Expand Down
1 change: 1 addition & 0 deletions tests/unit/ZipCodeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public function testIsValid()
$this->assertTrue(Validator::isValid('1234567890', 'US'));
$this->assertTrue(Validator::isValid('LV-1111', 'LV'));
$this->assertTrue(Validator::isValid('1111', 'LV'));
$this->assertTrue(Validator::isValid('06093-2227', 'US'));

$noPostCodeCountries = ['AE', 'AU', 'BA', 'CO', 'QA'];
foreach ($noPostCodeCountries as $country) {
Expand Down

0 comments on commit 8943ca9

Please sign in to comment.