question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Standard phone numbers in Brazil

See original GitHub issue

Hello 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:closed
  • Created 9 years ago
  • Comments:15 (4 by maintainers)

github_iconTop GitHub Comments

7reactions
renandecarlocommented, Mar 20, 2015

@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:

$("#telefone").inputmask({
    mask: ["(99) 9999-9999", "(99) 99999-9999"]
});
0reactions
RobinHerbotscommented, Aug 28, 2018

Remove Phone alias #1981

Read more comments on GitHub >

github_iconTop Results From Across the Web

List of dialling codes in Brazil - Wikipedia
List of dialling codes in Brazil ; Mato Grosso (65 and 66) · 65 – Southwest (Cuiabá, Cáceres) ; Paraíba (83) ; Amazonas...
Read more >
What is a cellphone number from Brazil look like? - Quora
Brazil code is +55. Area codes in Brazil always have two digits, varying from 11 to 99, depending on the region the number...
Read more >
Brazil - World Telephone Numbering Guide
Telephone numbers in Brazil changed to a standard 2-digit area code and 8-digit subscriber number in a long-term programme that completed by 31...
Read more >
Phone numbers in Sao Paulo, Brazil +55 11 - Zadarma
If you have a number in Brazil, you can port that number to Zadarma for free. ... Standard. $0. Number Sao Paulo -...
Read more >
Brazilian Time Zones, Standards and Phone Calls
Calling Brazil from abroad ... The country code for Brazil is (+55). To call Brazil first dial (+ 55 or 0055) + the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found