Skip to content

Instantly share code, notes, and snippets.

@emiliojva
Forked from robertopc/regex-validations.js
Created August 9, 2018 01:26
Show Gist options
  • Save emiliojva/58ca4332ca238f858f7867913308cde8 to your computer and use it in GitHub Desktop.
Save emiliojva/58ca4332ca238f858f7867913308cde8 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 protected]".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);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment