From 4ec30b773be5dc9a7d42bb0cfd2c9c35d6e4874a Mon Sep 17 00:00:00 2001 From: Divik Shrivastava Date: Sun, 3 Oct 2021 01:25:36 +0530 Subject: [PATCH] fix(isMobilePhone.js): regex for Belgium locale (#1746) * 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 --- src/lib/isMobilePhone.js | 2 +- test/validators.js | 18 ++++++++++++------ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/lib/isMobilePhone.js b/src/lib/isMobilePhone.js index aabd37512..8b56b769f 100644 --- a/src/lib/isMobilePhone.js +++ b/src/lib/isMobilePhone.js @@ -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}$/, diff --git a/test/validators.js b/test/validators.js index 6bea81c60..91794d521 100644 --- a/test/validators.js +++ b/test/validators.js @@ -7428,9 +7428,9 @@ describe('Validators', () => { '0470123456', '+32470123456', '32470123456', - '021234567', - '+3221234567', - '3221234567', + '0421234567', + '+32421234567', + '32421234567', ], invalid: [ '12345', @@ -7442,6 +7442,9 @@ describe('Validators', () => { '0212345678', '+320212345678', '320212345678', + '021234567', + '+3221234567', + '3221234567', ], }, { @@ -7450,9 +7453,9 @@ describe('Validators', () => { '0470123456', '+32470123456', '32470123456', - '021234567', - '+3221234567', - '3221234567', + '0421234567', + '+32421234567', + '32421234567', ], invalid: [ '12345', @@ -7464,6 +7467,9 @@ describe('Validators', () => { '0212345678', '+320212345678', '320212345678', + '021234567', + '+3221234567', + '3221234567', ], }, {