Created
January 19, 2022 08:54
-
-
Save jx13xx/244939a973cdc0f06541826b06504835 to your computer and use it in GitHub Desktop.
Email Validation in Javascript
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let cases = { | |
'firstName' : 'FirstName', | |
'lastName' : 'LastName', | |
'email': '[email protected]', | |
'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