levibeach
7/28/2016 - 12:42 PM

Check if valid email address

Check if valid email address

var email = "test@test.com";
var emailRE = /^(([^<>()[\]\\.,;:\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,}))$/

if (emailRE.test(email)) {
  // valid email
} else {
  //invalid email
}