Re: Re: Regular Expression help
| From: | J Smith | Date: | Fri, 29 Jun 2001 20:39:59 +0000 |
| Subject: | Re: Re: Regular Expression help | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-55609@lists.php.net to get a copy of this message | ||
Clayton Dukes wrote:
> Okay, here's what I have so far:
>
> ---snip---
> if ((!$email)
> || ($email=="")
> || (!eregi("^[_\.0-9a-z-]+@domain.+[a-z]",$email))
> )
> $stop = "<center>"._ERRORINVEMAIL."</center><br>";
> ---snip---
>
> This works, but how can I add a second domain?
> ie:
>
Try:
^[_\.0-9a-z-]+@(domainA|domainB|etc)\.[a-z]{2,3}$
A complete email address check is insanely hard to to if you want to get
RFC 822 compliant-checking, but who needs that anyways? (fwiw, the regex in
Mastering Regular Expressions for checking email address syntax is some
4,700 bytes long.)
J