note 39509 deleted from function.ereg by irchtml
| From: | irchtml@php.net | Date: | Wed, 25 Feb 2004 17:30:18 +0000 |
| Subject: | note 39509 deleted from function.ereg by irchtml | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-65740@lists.php.net to get a copy of this message | ||
Note Submitter: gem@rellim.com
----
Another correction to the email pattern. Lot's of email addresses contain '+'
chars. Listmanagers and whitelist spam blockers depend on this.
The TLD (after the last period) is all letters, no numbers.
No need to use a case insentive match then to match [a-zA-Z] when [a-z] will do.
Underscore is not legal in domain names (RFC 1035) but still is commonly used, so I allow it.
ANY char is legal in the username except [SPACE], =, or control chars (RFC 2821). Never seen <
or > work though.
So here is what I use, YMMV:
eregi("^[!-;a-~]+@([0-9a-z][\w\-]+\.)+[a-z]{2,6}$", $email)