replace overcomplicated regex for email validation with php function

This commit is contained in:
Felix Favre 2015-08-26 15:19:22 +02:00
parent 73208016bf
commit ecf25f5d2a
1 changed files with 1 additions and 1 deletions

View File

@ -43,7 +43,7 @@ function strip_item($item) {
* Überprüft eine E-Mail-Adresse.
*/
function check_email($email) {
return (bool) preg_match("#^([a-zA-Z0-9_+\-])+(\.([a-zA-Z0-9_+\-])+)*@((\[(((([0-1])?([0-9])?[0-9])|(2[0-4][0-9])|(2[0-5][0-5])))\.(((([0-1])?([0-9])?[0-9])|(2[0-4][0-9])|(2[0-5][0-5])))\.(((([0-1])?([0-9])?[0-9])|(2[0-4][0-9])|(2[0-5][0-5])))\.(((([0-1])?([0-9])?[0-9])|(2[0-4][0-9])|(2[0-5][0-5]))\]))|((([\p{L}0-9])+(([\-])+([\p{L}0-9])+)*\.)+([\p{L}])+(([\-])+([\p{L}0-9])+)*))$#u", $email);
return (bool) filter_var($email, FILTER_VALIDATE_EMAIL);
}
?>