Posted By

dreamstarter on 04/09/13


Tagged

regex email javascript validation


Versions (?)

Who likes this?

4 people have marked this snippet as a favorite

dreamstarter
shalomfriss
lionminister
Beppoi


email validation


 / Published in: JavaScript
 

Use a regex to check the email address input

  1. function checkEmail(email) {
  2. var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
  3. if (!reg.test(email)) return false;
  4. return true;
  5. }

Report this snippet  

You need to login to post a comment.