Last active
February 1, 2020 19:33
-
-
Save guilhermewebdev/5da7869710866d01b5be4fd7243d5693 to your computer and use it in GitHub Desktop.
Expressão regular de telefone brasileiro para JavaScript
This file contains hidden or 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
/((\([0-9]{2}\))|([0-9]{2}))( ?9)? ?([0-9]{4})(-| )?([0-9]{4})/igm | |
/* | |
O padrão aceita várias mascaras diferentes para o telefone, com ou sem o 9º digito. | |
Alguns exemplos são: | |
(##) 9 ####-#### | |
(##) ####-#### | |
Com ou sem os parêntesis: | |
## ####-#### | |
######-#### | |
Com ou sem o traço: | |
## #### #### | |
## ######## | |
## ####-#### | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment