Validating Email Addresses
Here is a quickie JavaScript function that validates an email address using a regular expression — with special thanks to HXS for fine-tuning the expression.
function checkEmail(userEmail) {
var emailExpression = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i;
if (userEmail.match(emailExpression)) {
return true;
} else {
return false;
}
}
About this entry
You’re currently reading “Validating Email Addresses,” an entry on Wercshop
- Published:
- 06.26.07 / 10pm
- Category:
- JavaScript, Programming, Tips & Tricks, Web
No comments
Jump to comment form | comments rss [?] | trackback uri [?]