Standard phone numbers in Brazil
See original GitHub issueHello Robin,
I saw you implement testing for the phone numbers in Brazil. However, the rule is not exactly the one that tested.
The new Brazilian standard is only applied to mobile phones, which will receive the digit 9 as a prefix.
Then we have the following situations (regex):
Mobile Phones: \([1-9]{2}\) 9[89]\d{3}-\d{4}
Special mobile phones (not receive the extra digit): \([1-9]{2}\) 7\d{3}-\d{4}
Phones “standard”: \([1-9]{2}\) [2-6]\d{3}-\d{4}
In fact, we are in transition to a new standard. Many area codes are still with the old standard. We have a transition schedule, if you want to know I can explain.
The EXACT (I Give Up!) rule at this time, is this mask that I created:
http://codepen.io/thiagotalma/pen/MYXvxp
But I have a little problem.
If you use area code where the transition has been made (definition n
) the mask works perfectly.
But when we enter a number with the area code according to the definition o
mask deteriorates when we enter the 11th digit.
Do you have any idea how to solve this? Or am I doing wrong and has another best way to achieve the same result?
Issue Analytics
- State:
- Created 9 years ago
- Comments:15 (4 by maintainers)
Top GitHub Comments
@thiagotalma Your definition is not actually right.
There were mobile numbers starting with
5,6, 7, 8 and 9. Line numbers started with 2, 3, 4_, 5_. So it was like that:Mobile numbers: (99) (6789){1}999-9999 Line numbers: (99) (2345){1}999-9999
With the new rule, it adds a leading ‘9’ to mobile numbers, exactly so that they can also use the 2345 initiations. Line numbers didn’t change. So now the mask can be translated into that:
Mobile numbers with leading nine: (99) [\9]{1}9999-9999 Standard mobile numbers and line numbers: (99) 9999-9999
What we need now is a single mask for both of these. I’m using this one now:
Remove Phone alias #1981