Skip to content

Commit 44224d7

Browse files
authored
fix(isMobilePhone): fix el-GR validation - add missing ranges and correctly exclude certain ranges (#2112)
* fix(isMobilePhone): el-GR RegExp fixed update the RegExp to correctly match (and exclude) number ranges as per official ITU numbering plan: https://web.archive.org/web/20221205170159/https://www.itu.int/dms_pub/itu-t/oth/02/02/T02020000550002PDFE.pdf fixes #2111 * tests: update tests for fixed el-GR RegExp belongs to #2111
1 parent a571b3e commit 44224d7

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

src/lib/isMobilePhone.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ const phones = {
3131
'de-CH': /^(\+41|0)([1-9])\d{1,9}$/,
3232
'de-LU': /^(\+352)?((6\d1)\d{6})$/,
3333
'dv-MV': /^(\+?960)?(7[2-9]|91|9[3-9])\d{7}$/,
34-
'el-GR': /^(\+?30|0)?(69\d{8})$/,
34+
'el-GR': /^(\+?30|0)?6(8[5-9]|9(?![26])[0-9])\d{7}$/,
3535
'el-CY': /^(\+?357?)?(9(9|6)\d{6})$/,
3636
'en-AI': /^(\+?1|0)264(?:2(35|92)|4(?:6[1-2]|76|97)|5(?:3[6-9]|8[1-4])|7(?:2(4|9)|72))\d{4}$/,
3737
'en-AU': /^(\+?61|0)4\d{8}$/,

test/validators.js

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7761,8 +7761,22 @@ describe('Validators', () => {
77617761
locale: 'el-GR',
77627762
valid: [
77637763
'+306944848966',
7764-
'6944848966',
77657764
'306944848966',
7765+
'06904567890',
7766+
'6944848966',
7767+
'6904567890',
7768+
'6914567890',
7769+
'6934567890',
7770+
'6944567890',
7771+
'6954567890',
7772+
'6974567890',
7773+
'6984567890',
7774+
'6994567890',
7775+
'6854567890',
7776+
'6864567890',
7777+
'6874567890',
7778+
'6884567890',
7779+
'6894567890',
77667780
],
77677781
invalid: [
77687782
'2102323234',
@@ -7772,6 +7786,12 @@ describe('Validators', () => {
77727786
'68129485729',
77737787
'6589394827',
77747788
'298RI89572',
7789+
'6924567890',
7790+
'6964567890',
7791+
'6844567890',
7792+
'690456789',
7793+
'00690456789',
7794+
'not a number',
77757795
],
77767796
},
77777797
{

0 commit comments

Comments
 (0)