Skip to content

Instantly share code, notes, and snippets.

@robertopc
Last active August 9, 2018 01:27
Show Gist options
  • Save robertopc/7a06562a4fded68876cb6a2add980a3e to your computer and use it in GitHub Desktop.
Save robertopc/7a06562a4fded68876cb6a2add980a3e to your computer and use it in GitHub Desktop.
Validações em Expressões Regulares no Javascript regex js
// Data e hora dd/mm/yyyy hh:mm
var data = "01/01/2000 12:00:00".match(/^(0[1-9]|[12][0-9]|3[01])\/(0[1-9]|1[0-2])\/[0-9]{4} (0[0-9]|1[0-9]|2[0-3]):([0-5][0-9])$/);
console.log(data);
// Email
var email = "email@abc.com".match(/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/);
console.log(email);
@emiliojva
Copy link

Forks! Mão na roda! Obrigado Roberto.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment