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");

2 thoughts on “Validate Email Address in Javascript”

  1. Christopher Allen-Poole

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

Leave a Reply

Your email address will not be published.