note 103736 deleted from function.preg-match by danbrown
| From: | danbrown@php.net | Date: | Sat, 30 Apr 2011 16:29:31 +0000 |
| Subject: | note 103736 deleted from function.preg-match by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-179314@lists.php.net to get a copy of this message | ||
Note Submitter: persian dot designer at usa dot com
----
Validate an E-Mail Address (Format)
modified your email validation pattern to solve these issues:
<?php
$pattern = "/^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/";
$email = "mymail@mysite.com";
if (!preg_match($pattern, $email)) {
echo "ERROR! your mail is not valid.";
} else {
echo "SUCCESS. your mail is valid.";
}
?>