Skip to content

Commit edb6b1c

Browse files
fix(isPostalCode): improve Dutch postal code regex (#2271)
1 parent 0a100fe commit edb6b1c

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/lib/isPostalCode.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ const patterns = {
5252
MX: fiveDigit,
5353
MT: /^[A-Za-z]{3}\s{0,1}\d{4}$/,
5454
MY: fiveDigit,
55-
NL: /^\d{4}\s?[a-z]{2}$/i,
55+
NL: /^[1-9]\d{3}\s?(?!sa|sd|ss)[a-z]{2}$/i,
5656
NO: fourDigit,
5757
NP: /^(10|21|22|32|33|34|44|45|56|57)\d{3}$|^(977)$/i,
5858
NZ: fourDigit,

test/validators.test.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11925,6 +11925,13 @@ describe('Validators', () => {
1192511925
'3950IO',
1192611926
'3997 GH',
1192711927
],
11928+
invalid: [
11929+
'1234',
11930+
'0603 JV',
11931+
'5194SA',
11932+
'9164 SD',
11933+
'1841SS',
11934+
],
1192811935
},
1192911936
{
1193011937
locale: 'NP',

0 commit comments

Comments
 (0)