From 4b11938c6b240e278979e66e28a57a863edd7f84 Mon Sep 17 00:00:00 2001 From: abdulazizkhatamov Date: Sun, 15 Mar 2026 06:49:43 +0500 Subject: [PATCH 1/2] fix(isMobilePhone): update tg-TJ regex to cover all valid Tajikistan operator codes Previous regex only matched the 55 prefix. Updated to include all valid mobile operator codes (00, 55, 88, 90, 91, 92, 93, 95, 98, 99) per the WFP Logistics Cluster telecommunications reference for Tajikistan. Fixes #2544 --- src/lib/isMobilePhone.js | 2 +- test/validators.test.js | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/lib/isMobilePhone.js b/src/lib/isMobilePhone.js index 84b8fcce0..42b728594 100644 --- a/src/lib/isMobilePhone.js +++ b/src/lib/isMobilePhone.js @@ -149,7 +149,7 @@ const phones = { 'sq-AL': /^(\+355|0)6[2-9]\d{7}$/, 'sr-RS': /^(\+3816|06)[- \d]{5,9}$/, 'sv-SE': /^(\+?46|0)[\s\-]?7[\s\-]?[02369]([\s\-]?\d){7}$/, - 'tg-TJ': /^(\+?992)?[5][5]\d{7}$/, + 'tg-TJ': /^(\+992|992)?(00|55|88|90|91|92|93|95|98|99)\d{7}$/, 'th-TH': /^(\+66|66|0)\d{9}$/, 'tr-TR': /^(\+?90|0)?5\d{9}$/, 'tk-TM': /^(\+993|993|8)\d{8}$/, diff --git a/test/validators.test.js b/test/validators.test.js index 1fa629092..d82d7fc44 100644 --- a/test/validators.test.js +++ b/test/validators.test.js @@ -10929,6 +10929,17 @@ describe('Validators', () => { '+992553322551', '992553388551', '992553322551', + '+992901234567', + '+992911234567', + '+992921234567', + '+992931234567', + '+992951234567', + '+992981234567', + '+992991234567', + '+992881234567', + '+992001234567', + '901234567', + '911234567', ], invalid: [ '12345', @@ -10941,6 +10952,9 @@ describe('Validators', () => { '9923633885', '99255363885', '66338855', + '+992941234567', + '+992961234567', + '+992971234567', ], }, { From 5f20ea1b0a2d77ebc1b81a7142cfd4fe89c4f1f6 Mon Sep 17 00:00:00 2001 From: abdulazizkhatamov Date: Sun, 15 Mar 2026 06:49:52 +0500 Subject: [PATCH 2/2] 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 42b728594..af146cc75 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 d82d7fc44..61a358a6d 100644 --- a/test/validators.test.js +++ b/test/validators.test.js @@ -11108,6 +11108,13 @@ describe('Validators', () => { '80091234', '81123456', '54123456', + '+38970123456', + '+38971123456', + '+38975123456', + '+38979123456', + '070123456', + '071123456', + '075123456', ], invalid: [ '38912345678',