Example #1
0
 /**
  * Check an email address for correct format.
  * @param   string  $email  email address
  * @return  boolean
  */
 public static function email($email)
 {
     if (Text::strlen($email) > 254) {
         return FALSE;
     }
     $expression = '/^[-_a-z0-9\'+*$^&%=~!?{}]++(?:\\.[-_a-z0-9\'+*$^&%=~!?{}]+)*+@(?:(?![-.])[-a-z0-9.]+(?<![-.])\\.[a-z]{2,6}|\\d{1,3}(?:\\.\\d{1,3}){3})$/iD';
     return (bool) preg_match($expression, (string) $email);
 }