Re: reg expression for ide-emails
| From: | John W. Holmes | Date: | Mon, 29 Mar 2004 14:11:08 +0000 |
| Subject: | Re: reg expression for ide-emails | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-181659@lists.php.net to get a copy of this message | ||
From: "Red Wingate" <redeye@erisx.de>
> >
> > if(strpos($email,'@'))
> >
> > No, seriously.
>
> 'Look @ the screen. You will find wonderfull colors there!'
>
> doesn't look like an e-mail adress, does it ? A basic approch to really
> check the syntax would be:
>
> preg_match("#^\s*[-\w_]+(\.[-\w_]+)*@[-\w_]+(\.[-\w_]+)+\s*$#sim", $email)
If you're going to validate a user@domain.crap.foo.bar address, why even
bother? Seriously. There are a 1000 different regular expressions for email
addresses out there and each of them have flaws to some extent.
If your application is so important that it requires a valid email address,
you should send them something to confirm it. Otherwise, just take whatever
crap they give... if they don't want emails, so be it.
---John Holmes...