Skip to content

Commit

Permalink
fix(isPostalCode): improve Dutch postal code regex (#2271)
Browse files Browse the repository at this point in the history
  • Loading branch information
RobinvanderVliet authored Apr 25, 2024
1 parent 0a100fe commit edb6b1c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/lib/isPostalCode.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const patterns = {
MX: fiveDigit,
MT: /^[A-Za-z]{3}\s{0,1}\d{4}$/,
MY: fiveDigit,
NL: /^\d{4}\s?[a-z]{2}$/i,
NL: /^[1-9]\d{3}\s?(?!sa|sd|ss)[a-z]{2}$/i,
NO: fourDigit,
NP: /^(10|21|22|32|33|34|44|45|56|57)\d{3}$|^(977)$/i,
NZ: fourDigit,
Expand Down
7 changes: 7 additions & 0 deletions test/validators.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11925,6 +11925,13 @@ describe('Validators', () => {
'3950IO',
'3997 GH',
],
invalid: [
'1234',
'0603 JV',
'5194SA',
'9164 SD',
'1841SS',
],
},
{
locale: 'NP',
Expand Down

0 comments on commit edb6b1c

Please sign in to comment.