From ec687fbdc54433696258cbf487d2696bd6e6564b Mon Sep 17 00:00:00 2001 From: tommyhgunz14 Date: Wed, 20 May 2026 21:01:19 +0000 Subject: [PATCH] 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 --- src/lib/isMobilePhone.js | 2 +- test/validators.test.js | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/lib/isMobilePhone.js b/src/lib/isMobilePhone.js index 32379bde5..83601dcbe 100644 --- a/src/lib/isMobilePhone.js +++ b/src/lib/isMobilePhone.js @@ -31,7 +31,7 @@ const phones = { 'de-DE': /^((\+49|0)1)(5[0-25-9]\d|6([23]|0\d?)|7([0-57-9]|6\d))\d{7,9}$/, 'de-AT': /^(\+43|0)\d{1,4}\d{3,12}$/, 'de-CH': /^(\+41|0)([1-9])\d{1,9}$/, - 'de-LU': /^(\+352)?((6\d1)\d{6})$/, + 'de-LU': /^(\+352)?((6\d{2})\d{6})$/, 'dv-MV': /^(\+?960)?(7[2-9]|9[1-9])\d{5}$/, 'el-GR': /^(\+?30|0)?6(8[5-9]|9(?![26])[0-9])\d{7}$/, 'el-CY': /^(\+?357?)?(9(9|7|6|5|4)\d{6})$/, diff --git a/test/validators.test.js b/test/validators.test.js index a4c3d7193..d8298b906 100644 --- a/test/validators.test.js +++ b/test/validators.test.js @@ -10659,6 +10659,13 @@ describe('Validators', () => { valid: [ '601123456', '+352601123456', + '+352621123456', + '+352628123456', + '+352661123456', + '+352671234567', + '+352691234567', + '628123456', + '691234567', ], invalid: [ 'NaN', @@ -10669,6 +10676,7 @@ describe('Validators', () => { '+112039812', '+352703123456', '1234', + '+352512345678', ], }, {