Published in: JavaScript
function is_valid_email (email) { return /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/.test(email); }
Comments
Subscribe to comments
You need to login to post a comment.
Pro JavaScript Techniques
Pro JavaScript Techniques is the ultimate JavaScript book for the modern web developer. It provides everything you need to know about modern JavaScript, and shows what JavaScript can do for your web sites. This book doesn't waste any time looking at things you already know, like basic syntax and structures.
wbowers on 02/28/08
regex email javascript js textmate validation
1 person has marked this snippet as a favorite
Published in: JavaScript
function is_valid_email (email) { return /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/.test(email); }
Subscribe to comments
You need to login to post a comment.
This snippet was causing firefox to freeze on longer email addresses.
This snippet was causing firefox to freeze on longer email addresses.
hm, interesting. How long was the email address?