We Recommend

Pro JavaScript Techniques 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.


Posted By

wbowers on 02/28/08


Tagged

regex email javascript js textmate validation


Versions (?)


Who likes this?

1 person has marked this snippet as a favorite

somedirection


JavaScript - is_valid_email


Published in: JavaScript 


  1. function is_valid_email (email)
  2. {
  3. return /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/.test(email);
  4. }

Report this snippet 

Comments

RSS Icon Subscribe to comments
Posted By: elightbo on March 11, 2008

This snippet was causing firefox to freeze on longer email addresses.

Posted By: elightbo on March 12, 2008

This snippet was causing firefox to freeze on longer email addresses.

Posted By: wbowers on April 5, 2008

hm, interesting. How long was the email address?

You need to login to post a comment.