From 90555917447e9f406a9dde3a2822661c383a6229 Mon Sep 17 00:00:00 2001 From: jhcaiafa <30915273+jhcaiafa@users.noreply.github.com> Date: Tue, 10 May 2022 14:53:41 -0300 Subject: [PATCH 1/2] Update isMobilePhone.js for pt-BR Fix regex for pt-BR, now accepting number 1 after number 9 for mobile phone numbers --- src/lib/isMobilePhone.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/isMobilePhone.js b/src/lib/isMobilePhone.js index e19184ba9..b7cdc8a17 100644 --- a/src/lib/isMobilePhone.js +++ b/src/lib/isMobilePhone.js @@ -113,7 +113,7 @@ const phones = { '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}$/, - 'pt-BR': /^((\+?55\ ?[1-9]{2}\ ?)|(\+?55\ ?\([1-9]{2}\)\ ?)|(0[1-9]{2}\ ?)|(\([1-9]{2}\)\ ?)|([1-9]{2}\ ?))((\d{4}\-?\d{4})|(9[2-9]{1}\d{3}\-?\d{4}))$/, + 'pt-BR': /^((\+?55\ ?[1-9]{2}\ ?)|(\+?55\ ?\([1-9]{2}\)\ ?)|(0[1-9]{2}\ ?)|(\([1-9]{2}\)\ ?)|([1-9]{2}\ ?))((\d{4}\-?\d{4})|(9[1-9]{1}\d{3}\-?\d{4}))$/, 'pt-PT': /^(\+?351)?9[1236]\d{7}$/, 'pt-AO': /^(\+244)\d{9}$/, 'ro-RO': /^(\+?4?0)\s?7\d{2}(\/|\s|\.|\-)?\d{3}(\s|\.|\-)?\d{3}$/, From 913d75c7178dc887d637befe91154e15c046836d Mon Sep 17 00:00:00 2001 From: jhcaiafa <30915273+jhcaiafa@users.noreply.github.com> Date: Tue, 10 May 2022 15:31:08 -0300 Subject: [PATCH 2/2] Update validator.js - pt-BR test for isMobilePhone valid and invalid test values updated due fix on isMobilePhone.js for pt-BR --- test/validators.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test/validators.js b/test/validators.js index 16fb6b89b..7839ebda8 100644 --- a/test/validators.js +++ b/test/validators.js @@ -6476,6 +6476,12 @@ describe('Validators', () => { '(22) 999567894', '(22) 99956-7894', '(11) 94123-4567', + '+55 11 91431-4567', + '+55 (11) 91431-4567', + '+551191431-4567', + '5511914314567', + '5511912345678', + '(11) 91431-4567', ], invalid: [ '0819876543', @@ -6484,12 +6490,6 @@ describe('Validators', () => { '5501599623874', '+55012962308', '+55 015 1234-3214', - '+55 11 91431-4567', - '+55 (11) 91431-4567', - '+551191431-4567', - '5511914314567', - '5511912345678', - '(11) 91431-4567', ], }, {