Skip to content

Commit

Permalink
fix(isMobilePhone): update de-DE validation (#933)
Browse files Browse the repository at this point in the history
  • Loading branch information
tux-tn authored and chriso committed Dec 23, 2018
1 parent 635c0af commit 285f58d
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 12 deletions.
2 changes: 1 addition & 1 deletion lib/isMobilePhone.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ var phones = {
'bn-BD': /\+?(88)?0?1[356789][0-9]{8}\b/,
'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[ \.\-]?)?([\(]{1}[0-9]{1,6}[\)])?([0-9 \.\-\/]{3,20})((x|ext|extension)[ ]?[0-9]{1,4})?$/,
'de-DE': /^(\+49)?0?1(5[0-25-9]\d|6([23]|0\d?)|7([0-57-9]|6\d))\d{7}$/,
'el-GR': /^(\+?30|0)?(69\d{8})$/,
'en-AU': /^(\+?61|0)4\d{8}$/,
'en-GB': /^(\+?44|0)7\d{9}$/,
Expand Down
2 changes: 1 addition & 1 deletion src/lib/isMobilePhone.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const phones = {
'bn-BD': /\+?(88)?0?1[356789][0-9]{8}\b/,
'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[ \.\-]?)?([\(]{1}[0-9]{1,6}[\)])?([0-9 \.\-\/]{3,20})((x|ext|extension)[ ]?[0-9]{1,4})?$/,
'de-DE': /^(\+49)?0?1(5[0-25-9]\d|6([23]|0\d?)|7([0-57-9]|6\d))\d{7}$/,
'el-GR': /^(\+?30|0)?(69\d{8})$/,
'en-AU': /^(\+?61|0)4\d{8}$/,
'en-GB': /^(\+?44|0)7\d{9}$/,
Expand Down
28 changes: 20 additions & 8 deletions test/validators.js
Original file line number Diff line number Diff line change
Expand Up @@ -3556,16 +3556,28 @@ describe('Validators', () => {
{
locale: 'de-DE',
valid: [
'+49 (0) 123 456 789',
'+49 (0) 123 456789',
'0123/4567890',
'+49 01234567890',
'+4901234567890',
'01234567890',
'+49015123456789',
'+4915123456789',
'015123456789',
'15123456789',
'15623456789',
'15623456789',
'1601234567',
'16012345678',
'1621234567',
'1631234567',
'1701234567',
'17612345678',
],
invalid: [
'',
'Vml2YW11cyBmZXJtZtesting123',
'15345678910',
'15412345678',
'16212345678',
'1761234567',
'16412345678',
'17012345678',
'12345678910',
'+4912345678910',
],
},
{
Expand Down
2 changes: 1 addition & 1 deletion validator.js
Original file line number Diff line number Diff line change
Expand Up @@ -1377,7 +1377,7 @@ var phones = {
'bn-BD': /\+?(88)?0?1[356789][0-9]{8}\b/,
'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[ \.\-]?)?([\(]{1}[0-9]{1,6}[\)])?([0-9 \.\-\/]{3,20})((x|ext|extension)[ ]?[0-9]{1,4})?$/,
'de-DE': /^(\+49)?0?1(5[0-25-9]\d|6([23]|0\d?)|7([0-57-9]|6\d))\d{7}$/,
'el-GR': /^(\+?30|0)?(69\d{8})$/,
'en-AU': /^(\+?61|0)4\d{8}$/,
'en-GB': /^(\+?44|0)7\d{9}$/,
Expand Down
2 changes: 1 addition & 1 deletion validator.min.js

Large diffs are not rendered by default.

0 comments on commit 285f58d

Please sign in to comment.