Skip to content

Commit

Permalink
Fix: Update regex for validating Israeli (he-IL) mobile number (#2503)
Browse files Browse the repository at this point in the history
  • Loading branch information
jamro committed Dec 7, 2024
1 parent 86911d8 commit ca6fb5e
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/lib/isMobilePhone.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ const phones = {
'fr-PF': /^(\+?689)?8[789]\d{6}$/,
'fr-RE': /^(\+?262|0|00262)[67]\d{8}$/,
'fr-WF': /^(\+681)?\d{6}$/,
'he-IL': /^(\+972|0)([23489]|5[012345689]|77)[1-9]\d{6}$/,
'he-IL': /^(\+972|0)([23489]|5[012345689]|7[12345679])[1-9]\d{6}$/,
'hu-HU': /^(\+?36|06)(20|30|31|50|70)\d{7}$/,
'id-ID': /^(\+?62|0)8(1[123456789]|2[1238]|3[1238]|5[12356789]|7[78]|9[56789]|8[123456789])([\s?|\d]{5,11})$/,
'ir-IR': /^(\+98|0)?9\d{9}$/,
Expand Down
28 changes: 28 additions & 0 deletions test/validators.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10819,6 +10819,34 @@ describe('Validators', () => {
args: [],
});

// he-IL non-Geographic
test({
validator: 'isMobilePhone',
valid: [
'+972718742400',
'+972722634352',
'+972723727704',
'+972732934633',
'+972733063541',
'+972737177616',
'+972747724838',
'+972765827274',
'+972768818873',
'+972771999972',
'+972792230168',
'+972793209243',
'+972795090837',
'+972796780768',
'+972797614164',
'+972798860797',
'+972799067720',
],
invalid: [
'+972700067720',
'+972781067720',
],
args: [],
});

it('should error on invalid locale', () => {
test({
Expand Down

0 comments on commit ca6fb5e

Please sign in to comment.