Skip to content

Commit ec687fb

Browse files
committed
fix(isMobilePhone): correct de-LU regex to allow all valid mobile prefixes
The de-LU (Luxembourg) mobile phone regex incorrectly required the third digit to be '1' (pattern: 6\d1), rejecting valid numbers like +352628123456 or +352678123456. Changed (6\d1) to (6\d{2}) to accept all Luxembourg mobile numbers starting with 6 followed by any two digits. Added test cases covering previously rejected valid prefixes (628, 661, 671, 691) and an additional invalid case. Closes #1727
1 parent 7fdc788 commit ec687fb

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

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-DE': /^((\+49|0)1)(5[0-25-9]\d|6([23]|0\d?)|7([0-57-9]|6\d))\d{7,9}$/,
3232
'de-AT': /^(\+43|0)\d{1,4}\d{3,12}$/,
3333
'de-CH': /^(\+41|0)([1-9])\d{1,9}$/,
34-
'de-LU': /^(\+352)?((6\d1)\d{6})$/,
34+
'de-LU': /^(\+352)?((6\d{2})\d{6})$/,
3535
'dv-MV': /^(\+?960)?(7[2-9]|9[1-9])\d{5}$/,
3636
'el-GR': /^(\+?30|0)?6(8[5-9]|9(?![26])[0-9])\d{7}$/,
3737
'el-CY': /^(\+?357?)?(9(9|7|6|5|4)\d{6})$/,

test/validators.test.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10659,6 +10659,13 @@ describe('Validators', () => {
1065910659
valid: [
1066010660
'601123456',
1066110661
'+352601123456',
10662+
'+352621123456',
10663+
'+352628123456',
10664+
'+352661123456',
10665+
'+352671234567',
10666+
'+352691234567',
10667+
'628123456',
10668+
'691234567',
1066210669
],
1066310670
invalid: [
1066410671
'NaN',
@@ -10669,6 +10676,7 @@ describe('Validators', () => {
1066910676
'+112039812',
1067010677
'+352703123456',
1067110678
'1234',
10679+
'+352512345678',
1067210680
],
1067310681
},
1067410682
{

0 commit comments

Comments
 (0)