Posted By

mattkenefick on 05/20/08


Tagged


Versions (?)

Who likes this?

4 people have marked this snippet as a favorite

mattkenefick
luman
robe
Arvi


PHP Regex: IsValidEmail


 / Published in: PHP
 

  1. function isValidEmail($value){
  2. $pattern = "/^([a-zA-Z0-9])+([\.a-zA-Z0-9_-])*@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-]+)+/";
  3. return preg_match($pattern, $value);
  4. }

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: cornellsteven on March 14, 2009

What if you enter a valid email with two periods, such as [email protected]?

Posted By: cornellsteven on March 14, 2009

Sorry, never mind!

You need to login to post a comment.