Skip to content

Commit 285f58d

Browse files
tux-tnchriso
authored andcommittedDec 23, 2018
fix(isMobilePhone): update de-DE validation (#933)
1 parent 635c0af commit 285f58d

File tree

5 files changed

+24
-12
lines changed

5 files changed

+24
-12
lines changed
 

‎lib/isMobilePhone.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ var phones = {
2626
'bn-BD': /\+?(88)?0?1[356789][0-9]{8}\b/,
2727
'cs-CZ': /^(\+?420)? ?[1-9][0-9]{2} ?[0-9]{3} ?[0-9]{3}$/,
2828
'da-DK': /^(\+?45)?\s?\d{2}\s?\d{2}\s?\d{2}\s?\d{2}$/,
29-
'de-DE': /^(\+?49[ \.\-]?)?([\(]{1}[0-9]{1,6}[\)])?([0-9 \.\-\/]{3,20})((x|ext|extension)[ ]?[0-9]{1,4})?$/,
29+
'de-DE': /^(\+49)?0?1(5[0-25-9]\d|6([23]|0\d?)|7([0-57-9]|6\d))\d{7}$/,
3030
'el-GR': /^(\+?30|0)?(69\d{8})$/,
3131
'en-AU': /^(\+?61|0)4\d{8}$/,
3232
'en-GB': /^(\+?44|0)7\d{9}$/,

‎src/lib/isMobilePhone.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const phones = {
1616
'bn-BD': /\+?(88)?0?1[356789][0-9]{8}\b/,
1717
'cs-CZ': /^(\+?420)? ?[1-9][0-9]{2} ?[0-9]{3} ?[0-9]{3}$/,
1818
'da-DK': /^(\+?45)?\s?\d{2}\s?\d{2}\s?\d{2}\s?\d{2}$/,
19-
'de-DE': /^(\+?49[ \.\-]?)?([\(]{1}[0-9]{1,6}[\)])?([0-9 \.\-\/]{3,20})((x|ext|extension)[ ]?[0-9]{1,4})?$/,
19+
'de-DE': /^(\+49)?0?1(5[0-25-9]\d|6([23]|0\d?)|7([0-57-9]|6\d))\d{7}$/,
2020
'el-GR': /^(\+?30|0)?(69\d{8})$/,
2121
'en-AU': /^(\+?61|0)4\d{8}$/,
2222
'en-GB': /^(\+?44|0)7\d{9}$/,

‎test/validators.js

+20-8
Original file line numberDiff line numberDiff line change
@@ -3556,16 +3556,28 @@ describe('Validators', () => {
35563556
{
35573557
locale: 'de-DE',
35583558
valid: [
3559-
'+49 (0) 123 456 789',
3560-
'+49 (0) 123 456789',
3561-
'0123/4567890',
3562-
'+49 01234567890',
3563-
'+4901234567890',
3564-
'01234567890',
3559+
'+49015123456789',
3560+
'+4915123456789',
3561+
'015123456789',
3562+
'15123456789',
3563+
'15623456789',
3564+
'15623456789',
3565+
'1601234567',
3566+
'16012345678',
3567+
'1621234567',
3568+
'1631234567',
3569+
'1701234567',
3570+
'17612345678',
35653571
],
35663572
invalid: [
3567-
'',
3568-
'Vml2YW11cyBmZXJtZtesting123',
3573+
'15345678910',
3574+
'15412345678',
3575+
'16212345678',
3576+
'1761234567',
3577+
'16412345678',
3578+
'17012345678',
3579+
'12345678910',
3580+
'+4912345678910',
35693581
],
35703582
},
35713583
{

‎validator.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1377,7 +1377,7 @@ var phones = {
13771377
'bn-BD': /\+?(88)?0?1[356789][0-9]{8}\b/,
13781378
'cs-CZ': /^(\+?420)? ?[1-9][0-9]{2} ?[0-9]{3} ?[0-9]{3}$/,
13791379
'da-DK': /^(\+?45)?\s?\d{2}\s?\d{2}\s?\d{2}\s?\d{2}$/,
1380-
'de-DE': /^(\+?49[ \.\-]?)?([\(]{1}[0-9]{1,6}[\)])?([0-9 \.\-\/]{3,20})((x|ext|extension)[ ]?[0-9]{1,4})?$/,
1380+
'de-DE': /^(\+49)?0?1(5[0-25-9]\d|6([23]|0\d?)|7([0-57-9]|6\d))\d{7}$/,
13811381
'el-GR': /^(\+?30|0)?(69\d{8})$/,
13821382
'en-AU': /^(\+?61|0)4\d{8}$/,
13831383
'en-GB': /^(\+?44|0)7\d{9}$/,

‎validator.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)
Please sign in to comment.