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");
0 0 vote
Article Rating
Subscribe
Notify of
guest
2 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments
duncan
duncan
6 years ago

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

Christopher Allen-Poole
Christopher Allen-Poole
6 years ago

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