Skip to content

Commit

Permalink
fix:refined regex for all mk numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
eshward95 committed Nov 21, 2024
1 parent aa5a410 commit ccd4647
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/lib/isMobilePhone.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,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-8]\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}))$/,
};
/* eslint-enable max-len */

Expand Down
15 changes: 10 additions & 5 deletions test/validators.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10733,24 +10733,29 @@ describe('Validators', () => {
{
locale: 'mk-MK',
valid: [
'+38921234567',
'+38971234567',
'+38923234567',
'38931234567',
'38961234567',
'21234567',
'022123456',
'22234567',
'71234567',
'31234567',
'+38923091500',
'80091234',
'81123456',
'54123456',
],
invalid: [
'38912345678',
'+389123456789',
'2123456',
'21234567',
'123456789',
'+3891234567',
'700012345',
'510123456',
'This should fail',
'+389123456',
'389123456',
'80912345',
],
},
];
Expand Down

0 comments on commit ccd4647

Please sign in to comment.