Posted By

alyssonweb on 12/14/10


Tagged

email valid php check address


Versions (?)

Who likes this?

5 people have marked this snippet as a favorite

Hepamin
qubestream
alyssonweb
summer_charlie
vp_arth


Check for valid email address RFC


 / Published in: PHP
 

  1. function validateEmail($email)
  2. {
  3. return preg_match('/^(?:[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+\.)*[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+@(?:(?:(?:[a-zA-Z0-9_](?:[a-zA-Z0-9_\-](?!\.)){0,61}[a-zA-Z0-9_-]?\.)+[a-zA-Z0-9_](?:[a-zA-Z0-9_\-](?!$)){0,61}[a-zA-Z0-9_]?)|(?:\[(?:(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\.){3}(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\]))$/', $email);
  4. }

Report this snippet  

You need to login to post a comment.