Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

regex cpf

// CPF
/^d{3}.d{3}.d{3}-d{2}$/

// Para CNPJ
/^d{2}.d{3}.d{3}/d{4}-d{2}$/

// Para ambos ao mesmo tempo
/(^d{3}.d{3}.d{3}-d{2}$)|(^d{2}.d{3}.d{3}/d{4}-d{2}$)/
 
PREVIOUS NEXT
Tagged: #regex #cpf
ADD COMMENT
Topic
Name
4+2 =