Re: Regular Expressions
| From: | Evan Nemerson | Date: | Tue, 23 Apr 2002 22:37:40 +0000 |
| Subject: | Re: Regular Expressions | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-94278@lists.php.net to get a copy of this message | ||
Uhhh... something like
ereg("[_a-zA-Z\-]+\@[\.a-zA-Z\-]+\.com",$variable);
SHOULD work... If you want to make sure they're @domain.com instead of any
domain, try...
ereg("[_a-zA-Z\-]+\@[\.a-zA-Z\-]+domain\.com",$variable);
if you want to validate e-mail address formats, there is (if memory serves) a
discussion in the comments on php.net/eregi of how to do this best.
> I need to check a variable to see if the format fits one
> of the following:
>
> username@domain.com
> or
> *@domain.com
> or
> *@*.domain.com
>
> How can I do this with regex? Any help would be greatly
> appreciated.
>
> Devin Atencio
--
And in knowing that you know nothing, that makes you the smartest of all.
Socrates