E-mail Validation

<?php

   $email = "some@email.com";

   if(preg_match("~([a-zA-Z0-9!#$%&'*+-/=?^_`{|}~])@([a-zA-Z0-9-]).([a-zA-Z0-9]{2,4})~", $email))
   {
       echo 'This is a valid email.';
   }
   else
   {
       echo 'This is an invalid email.';
   }
?>

Do you find this helpful?

Related articles