Skip to content

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");
Code language: JavaScript (javascript)

See also  [Solved] Error: Cannot find module '../lib/cli.js'
Subscribe
Notify of
guest
3 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments
saho
saho
2 years ago

This is very helpful

duncan
duncan
8 years ago

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

Christopher Allen-Poole
Christopher Allen-Poole
9 years ago

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

3
0
Would love your thoughts, please comment.x
()
x