Skip to content

Commit 29134a9

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 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 9fa1e3a commit 29134a9

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
@@ -11094,6 +11094,13 @@ describe('Validators', () => {
1109411094
'80091234',
1109511095
'81123456',
1109611096
'54123456',
11097+
'+38970123456',
11098+
'+38971123456',
11099+
'+38975123456',
11100+
'+38979123456',
11101+
'070123456',
11102+
'071123456',
11103+
'075123456',
1109711104
],
1109811105
invalid: [
1109911106
'38912345678',

0 commit comments

Comments
 (0)