Skip to content

Instantly share code, notes, and snippets.

@marcaum54
Created May 14, 2015 19:49
Show Gist options
  • Save marcaum54/9288fca85790f8d0ad9f to your computer and use it in GitHub Desktop.
Save marcaum54/9288fca85790f8d0ad9f to your computer and use it in GitHub Desktop.
Laravel: Regex Validators
$examples = [
'cpf' => [ 'regex:/^\d{3}.\d{3}.\d{3}-\d{2}$/' ],
'cnpj' => [ 'regex:/^\d{2}.\d{3}.\d{3}\/\d{4}-\d{2}$/' ],
'telefone' => [ 'regex:/^\(\d{2}\) \d{4}-\d{4,5}$/' ],
'cep' => [ 'regex:/^\d{5}-\d{3}$/' ],
];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment