From 02c47bacb6b5a6e017bd817a2694791961555233 Mon Sep 17 00:00:00 2001 From: abdulazizkhatamov Date: Sun, 15 Mar 2026 06:42:50 +0500 Subject: [PATCH] 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 --- src/lib/isMobilePhone.js | 2 +- test/validators.test.js | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/lib/isMobilePhone.js b/src/lib/isMobilePhone.js index 84b8fcce0..59bb8514f 100644 --- a/src/lib/isMobilePhone.js +++ b/src/lib/isMobilePhone.js @@ -162,7 +162,7 @@ const phones = { 'ar-YE': /^(((\+|00)9677|0?7)[0137]\d{7}|((\+|00)967|0)[1-7]\d{6})$/, 'ar-EH': /^(\+?212|0)[\s\-]?(5288|5289)[\s\-]?\d{5}$/, 'fa-AF': /^(\+93|0)?(2{1}[0-8]{1}|[3-5]{1}[0-4]{1})(\d{7})$/, - '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}))$/, + '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}))$/, }; /* eslint-enable max-len */ diff --git a/test/validators.test.js b/test/validators.test.js index 1fa629092..999fdd428 100644 --- a/test/validators.test.js +++ b/test/validators.test.js @@ -11094,6 +11094,13 @@ describe('Validators', () => { '80091234', '81123456', '54123456', + '+38970123456', + '+38971123456', + '+38975123456', + '+38979123456', + '070123456', + '071123456', + '075123456', ], invalid: [ '38912345678',