Skip to content

Commit 5f20ea1

Browse files
fix(isMobilePhone): fix mk-MK regex to correctly validate Macedonian mobile numbers
The previous regex used `7[0-9][2-9]\d{5}` which incorrectly restricted the third digit to 2-9, causing valid mobile numbers like +38970123456 and 070123456 (070-079 range) to fail validation. Fixed to `7[0-9]\d{6}` to allow all valid Macedonian mobile operator prefixes. Fixes #2497
1 parent 4b11938 commit 5f20ea1

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/lib/isMobilePhone.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ const phones = {
162162
'ar-YE': /^(((\+|00)9677|0?7)[0137]\d{7}|((\+|00)967|0)[1-7]\d{6})$/,
163163
'ar-EH': /^(\+?212|0)[\s\-]?(5288|5289)[\s\-]?\d{5}$/,
164164
'fa-AF': /^(\+93|0)?(2{1}[0-8]{1}|[3-5]{1}[0-4]{1})(\d{7})$/,
165-
'mk-MK': /^(\+?389|0)?((?:2[2-9]\d{6}|(?:3[1-4]|4[2-8])\d{6}|500\d{5}|5[2-9]\d{6}|7[0-9][2-9]\d{5}|8[1-9]\d{6}|800\d{5}|8009\d{4}))$/,
165+
'mk-MK': /^(\+?389|0)?((?:2[2-9]\d{6}|(?:3[1-4]|4[2-8])\d{6}|500\d{5}|5[2-9]\d{6}|7[0-9]\d{6}|8[1-9]\d{6}|800\d{5}|8009\d{4}))$/,
166166
};
167167
/* eslint-enable max-len */
168168

test/validators.test.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11108,6 +11108,13 @@ describe('Validators', () => {
1110811108
'80091234',
1110911109
'81123456',
1111011110
'54123456',
11111+
'+38970123456',
11112+
'+38971123456',
11113+
'+38975123456',
11114+
'+38979123456',
11115+
'070123456',
11116+
'071123456',
11117+
'075123456',
1111111118
],
1111211119
invalid: [
1111311120
'38912345678',

0 commit comments

Comments
 (0)