Validate Email Address in Javascript

Below is a nice little Javascript RegularExpression to validate email addresses.

/^\[email protected][a-zA-Z_.]+?\.[a-zA-Z.]{2,3}$/

..and to use it..

if (/^\[email protected][a-zA-Z_.]+?\.[a-zA-Z.]{2,3}$/.test(email)) alert("Success");
else alert("Fail");
5 2 votes
Article Rating
Subscribe
Notify of
guest
3 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments
saho
saho
17 days ago

This is very helpful

duncan
duncan
6 years ago

email = “[email protected]”;
email = “[email protected]”;

Christopher Allen-Poole
Christopher Allen-Poole
7 years ago

And if you have a .museum email address… you’ll just have to go out and get another email address.