Skip to content

Commit

Permalink
fix(isMobilePhone.js): regex for Belgium locale (#1746)
Browse files Browse the repository at this point in the history
* Updating regex of Belgium and the valid and invalid phone numbers in validators.js

* Fixing accidental deletion of closing braces

* Fixing the test numbers for fr-BE (french Belgium) too in validators.js since phone number rules will be same for that too

Co-authored-by: Divik Shrivastava <divik.s@safe.security>
  • Loading branch information
divikshrivastava and Divik Shrivastava committed Oct 2, 2021
1 parent f2a1587 commit 4ec30b7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/lib/isMobilePhone.js
Expand Up @@ -95,7 +95,7 @@ const phones = {
'mz-MZ': /^(\+?258)?8[234567]\d{7}$/,
'nb-NO': /^(\+?47)?[49]\d{7}$/,
'ne-NP': /^(\+?977)?9[78]\d{8}$/,
'nl-BE': /^(\+?32|0)4?\d{8}$/,
'nl-BE': /^(\+?32|0)4\d{8}$/,
'nl-NL': /^(((\+|00)?31\(0\))|((\+|00)?31)|0)6{1}\d{8}$/,
'nn-NO': /^(\+?47)?[49]\d{7}$/,
'pl-PL': /^(\+?48)? ?[5-8]\d ?\d{3} ?\d{2} ?\d{2}$/,
Expand Down
18 changes: 12 additions & 6 deletions test/validators.js
Expand Up @@ -7428,9 +7428,9 @@ describe('Validators', () => {
'0470123456',
'+32470123456',
'32470123456',
'021234567',
'+3221234567',
'3221234567',
'0421234567',
'+32421234567',
'32421234567',
],
invalid: [
'12345',
Expand All @@ -7442,6 +7442,9 @@ describe('Validators', () => {
'0212345678',
'+320212345678',
'320212345678',
'021234567',
'+3221234567',
'3221234567',
],
},
{
Expand All @@ -7450,9 +7453,9 @@ describe('Validators', () => {
'0470123456',
'+32470123456',
'32470123456',
'021234567',
'+3221234567',
'3221234567',
'0421234567',
'+32421234567',
'32421234567',
],
invalid: [
'12345',
Expand All @@ -7464,6 +7467,9 @@ describe('Validators', () => {
'0212345678',
'+320212345678',
'320212345678',
'021234567',
'+3221234567',
'3221234567',
],
},
{
Expand Down

0 comments on commit 4ec30b7

Please sign in to comment.