Last active
December 22, 2015 02:48
-
-
Save leods92/6405525 to your computer and use it in GitHub Desktop.
Validação de números celulares no Brasil (válido em 1º de setembro de 2013).
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
# first 2 digits represent dialing code | |
# dialing codes in Brazil don't start with 0 | |
# | |
# the following represent the phone | |
# must have 8 digits | |
# might have 9 if dialing code is 11, 12, 13, 14, 15, 16, 17, 18 or 19 | |
# http://g1.globo.com/sao-paulo/noticia/2013/08/nono-digito-comeca-valer-para-telefones-celulares-do-interior-paulista.html | |
# first digit must start with 7, 8 or 9 | |
# might start with 5 as well if dialing code is 11 | |
# | |
MOBILE_REGEXP = /\A(11(5|[7-9])\d{7,8}|1[2-9][7-9]\d{7,8}|[2-9]\d[7-9]\d{7})\z/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
E para quem procura um validator completo para Rails que também avalia números fixos: https://gist.github.com/leods92/6405552