note 49289 deleted from function.eregi by cece
| From: | cece@php.net | Date: | Sun, 23 Jan 2005 11:22:27 +0000 |
| Subject: | note 49289 deleted from function.eregi by cece | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-83812@lists.php.net to get a copy of this message | ||
Note Submitter: admin at crazydrumguy dot info
Reason: useless
----
These long regular expressions can get confusing. I find it easier to split the email addresses up
first and then validate them.
<?php
$split_address = explode("@",$email);
$split_domain = explode(".",$split_addres[1]);
//then validate $split_address[0], $split_domain[0], and $split_domain[1]
?>
If you want to check email addresses with multiple "."s (i.e. @yahoo.co.uk), use the
following:
<?php
$split_address = explode("@",$email);
$split_domain = explode(".",$split_addres[1]);
//validate $split_address[0]
for(x = 0; x < count($split_address[1]); x++) {
//validate $split_domain[0]
}
?>