From 367add4db067e6e16e8a2969b623f1104be248ab Mon Sep 17 00:00:00 2001 From: Heanzy Zabala Date: Sat, 25 Jul 2020 13:11:01 +0800 Subject: [PATCH] bug(isMobilePhone): update regex for de-DE --- src/lib/isMobilePhone.js | 2 +- test/validators.js | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/lib/isMobilePhone.js b/src/lib/isMobilePhone.js index 2362807c5..dbd95c9cd 100644 --- a/src/lib/isMobilePhone.js +++ b/src/lib/isMobilePhone.js @@ -20,7 +20,7 @@ const phones = { 'bn-BD': /^(\+?880|0)1[13456789][0-9]{8}$/, 'cs-CZ': /^(\+?420)? ?[1-9][0-9]{2} ?[0-9]{3} ?[0-9]{3}$/, 'da-DK': /^(\+?45)?\s?\d{2}\s?\d{2}\s?\d{2}\s?\d{2}$/, - 'de-DE': /^(\+49)?0?1(5[0-25-9]\d|6([23]|0\d?)|7([0-57-9]|6\d))\d{7}$/, + 'de-DE': /^(\+49)?0?[1|3]([0|5][0-45-9]\d|6([23]|0\d?)|7([0-57-9]|6\d))\d{7}$/, 'de-AT': /^(\+43|0)\d{1,4}\d{3,12}$/, 'de-CH': /^(\+41|0)(7[5-9])\d{1,7}$/, 'el-GR': /^(\+?30|0)?(69\d{8})$/, diff --git a/test/validators.js b/test/validators.js index 81ad1d473..e64abb7af 100755 --- a/test/validators.js +++ b/test/validators.js @@ -5155,6 +5155,7 @@ describe('Validators', () => { valid: [ '+49015123456789', '+4915123456789', + '+4930405044550', '015123456789', '15123456789', '15623456789', @@ -5165,15 +5166,16 @@ describe('Validators', () => { '1631234567', '1701234567', '17612345678', - ], - invalid: [ '15345678910', '15412345678', + ], + invalid: [ + '34412345678', + '14412345678', '16212345678', '1761234567', '16412345678', '17012345678', - '12345678910', '+4912345678910', ], },