Validating Subdomain E-mail Addresses Using Regular Expressions
| From: | Jami Moore | Date: | Mon, 08 Sep 2003 06:08:43 +0000 |
| Subject: | Validating Subdomain E-mail Addresses Using Regular Expressions | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-161958@lists.php.net to get a copy of this message | ||
I have been trying all weekend to get this right, and so far it does not
validate an e-mail address with a subdomain.
-- Code --
$empatt =
"^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$";
if(eregi($empatt, $email))
{
//do stuff
}
-- End Code --
From my understanding, this should allow me to validate an e-mail
address like <mailto:someone@subdomain.domain.com>
someone@subdomain.domain.com. Has anyone been able to come up with a
regular expression that will allow php to validate an e-mail address
like this?
Jami Moore
Owner / Designer
LightSpark Digital Designs
<mailto:contact@lightsparkdigital.com>
contact@lightsparkdigital.com
<http://www.lightsparkdigital.com/> http://www.lightsparkdigital.com/