AW: [PHP] ereg matching email address
| From: | Jochen Kächelin | Date: | Wed, 06 Sep 2000 12:40:03 +0000 |
| Subject: | AW: [PHP] ereg matching email address | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-15508@lists.php.net to get a copy of this message | ||
try this function:
function checkemail($email)
{
if (eregi("(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)", $email) || !eregi
("^.+\@(\[?)[-a-zA-Z0-9\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$",
$email)) { return(false); }
else { list($user, $domain) = explode("@", $email);
if ((!eregi("^[a-zA-Z0-9\.\-]+$", $user))
||(!eregi("^[a-zA-Z0-9\.\-]+$", $domain))) {
return false; }
else {return(true); }
}
}
> -----Ursprüngliche Nachricht-----
> Von: Monte Ohrt [mailto:monte@ispi.net]
> Gesendet am: Dienstag, 5. September 2000 23:24
> An: php-general@lists.php.net; kris@grinz.com
> Betreff: Re: [PHP] ereg matching email address
>
> You can port it from perl if you wish :-)
>
> http://public.yahoo.com/~jfriedl/regex/email-opt.pl
>
> kris@grinz.com wrote:
> >
> > Hi,
> >
> > I am having trouble with ereg matching an email address. I am
> > unable to find any examples of this explicitly. Can someone send
> > me the ereg pattern for checking whether an email address is valid
> > or not? I have tried a few ereg patterns with no success.
> >
> > Kris
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> > For additional commands, e-mail: php-general-help@lists.php.net
> > To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
> --
> Monte Ohrt <monte@ispi.net>
> http://www.ispi.net/
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>