diff --git a/src/Formatter/NLFormatter.php b/src/Formatter/NLFormatter.php index a764677..041bcef 100644 --- a/src/Formatter/NLFormatter.php +++ b/src/Formatter/NLFormatter.php @@ -19,7 +19,7 @@ final class NLFormatter implements CountryPostcodeFormatter { public function format(string $postcode) : ?string { - if (preg_match('/^([0-9]{4})([A-Z]{2})$/', $postcode, $matches) !== 1) { + if (preg_match('/^([1-9][0-9]{3})([A-Z]{2})$/', $postcode, $matches) !== 1) { return null; } diff --git a/tests/Formatter/NLFormatterTest.php b/tests/Formatter/NLFormatterTest.php index ad52725..b562b19 100644 --- a/tests/Formatter/NLFormatterTest.php +++ b/tests/Formatter/NLFormatterTest.php @@ -23,6 +23,7 @@ public function providerFormat() : array return [ ['', null], + ['0123AB', null], ['1234AB', '1234 AB'], ['1234SS', null], ['1234SD', null],