Skip to content

Instantly share code, notes, and snippets.

@jx13xx
Created January 19, 2022 08:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jx13xx/244939a973cdc0f06541826b06504835 to your computer and use it in GitHub Desktop.
Save jx13xx/244939a973cdc0f06541826b06504835 to your computer and use it in GitHub Desktop.
Email Validation in Javascript
let cases = {
'firstName' : 'FirstName',
'lastName' : 'LastName',
'email': 'first_last@gmail.com',
'salary': 500235
}
const verifiedEmail = !!cases["email"].match(/([a-zA-Z0-9_\-\.]+)@([a-zA-Z0-9_\-\.]+)\.([a-zA-Z]{2,5})$/)
// OR
function isValidEmail(employeeEmail){
return !!employeeEmail.match(/([a-zA-Z0-9_\-\.]+)@([a-zA-Z0-9_\-\.]+)\.([a-zA-Z]{2,5})$/)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment