Re: Validating Email addrs
| From: | Richard Heyes | Date: | Tue, 15 Nov 2005 16:24:25 +0000 |
| Subject: | Re: Validating Email addrs | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-225834@lists.php.net to get a copy of this message | ||
Leonard Burton wrote:
Hi All, I know that it is pretty darn impossible to come up with a regular expression for validating emails. How do you all validated emails on form submission? Is it good just to do something like "/.+@.+[.].+/" ? That (or a close derivative) should match that there is at least a @ and a . with chars before and after each. I will be sending an email to each new registration with a confirmation link. Does that regex make about the best sense?Try this, (# is the regex delimiter): #^([\w.+-]+)@(([\da-z-]+\.)+[\da-z]{2,4})$#i -- Richard Heyes http://www.phpguru.org