Skip to content

Commit 7bef722

Browse files
authored
fix(isPostalCode): fix overly permissive BY regexp (#2134)
fixes #2133
1 parent 8e004e0 commit 7bef722

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/lib/isPostalCode.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const patterns = {
1515
BE: fourDigit,
1616
BG: fourDigit,
1717
BR: /^\d{5}-\d{3}$/,
18-
BY: /2[1-4]{1}\d{4}$/,
18+
BY: /^2[1-4]\d{4}$/,
1919
CA: /^[ABCEGHJKLMNPRSTVXY]\d[ABCEGHJ-NPRSTV-Z][\s\-]?\d[ABCEGHJ-NPRSTV-Z]\d$/i,
2020
CH: fourDigit,
2121
CN: /^(0[1-7]|1[012356]|2[0-7]|3[0-6]|4[0-7]|5[1-7]|6[1-7]|7[1-5]|8[1345]|9[09])\d{4}$/,

test/validators.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11311,6 +11311,12 @@ describe('Validators', () => {
1131111311
'247710',
1131211312
'231960',
1131311313
],
11314+
invalid: [
11315+
'test 225320',
11316+
'211120 test',
11317+
'317543',
11318+
'267946',
11319+
],
1131411320
},
1131511321
{
1131611322
locale: 'CA',

0 commit comments

Comments
 (0)