Created
February 15, 2013 18:56
-
-
Save dgmike/4962499 to your computer and use it in GitHub Desktop.
Regular expression to test phone numbers in Brazil, including the new Sao Paulo cel phones - that needs to have 9 in first non DDD number.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
regexTel = /^\(11\) 9\d{4}-\d{4}|\((?:1[2-9]|[2-9]\d)\) [5-9]\d{3}-\d{4}$/ | |
"(11) 93827-5555".match(regexTel) // OK | |
"(12) 8201-5555".match(regexTel) // OK | |
"(11) 89201-5555".match(regexTel) // NOT OK | |
"(12) 99201-5555".match(regexTel) // NOT OK | |
"(11) 4201-5555".match(regexTel) // NOT OK |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment