Return to Snippet

Revision: 50082
at August 8, 2011 21:46 by antti


Initial Code
/**
 * Validate email address
 * @param   string $email Email address to validate
 * @return  bool Returns TRUE if valid
 */
public static function validate($email) {
    return preg_match("/^[A-Za-z0-9_!#$%*/?|^{}`~&'+-=]+(.[A-Za-z0-9_!#$%*/?|^{}`~&'+-=]+)*@[A-Za-z0-9-]+(.[A-Za-z0-9-]+)*(.[A-Za-z0-9-]{2,6})$/", $email);
}

Initial URL

                                

Initial Description

                                

Initial Title
Validate email address

Initial Tags
email, php, textmate, validation

Initial Language
Other