diff --git a/src/lib/isPostalCode.js b/src/lib/isPostalCode.js index 1c45ca1c1..e6213914f 100644 --- a/src/lib/isPostalCode.js +++ b/src/lib/isPostalCode.js @@ -15,7 +15,7 @@ const patterns = { BE: fourDigit, BG: fourDigit, BR: /^\d{5}-\d{3}$/, - BY: /2[1-4]{1}\d{4}$/, + BY: /^2[1-4]\d{4}$/, CA: /^[ABCEGHJKLMNPRSTVXY]\d[ABCEGHJ-NPRSTV-Z][\s\-]?\d[ABCEGHJ-NPRSTV-Z]\d$/i, CH: fourDigit, 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}$/, diff --git a/test/validators.js b/test/validators.js index ee17c8592..521549585 100644 --- a/test/validators.js +++ b/test/validators.js @@ -11311,6 +11311,12 @@ describe('Validators', () => { '247710', '231960', ], + invalid: [ + 'test 225320', + '211120 test', + '317543', + '267946', + ], }, { locale: 'CA',