Vaildate Email Address
Description: Simple regular expression based algorithm for determining if an email address is valid. Great for signup forms or verifying usernames which might be a person's email.
Tested Platform: All modern browsers
Language: Javascript
function validateEmail(emailAddress) {
return /^[a-z0-9_-][a-z0-9._-]+@([a-z0-9][a-z0-9-]*.)+[a-z]{2,6}$/i.test(emailAddress);
}
Posted: March 20, 2023
Return to the snippets listing