note 39509 added to function.ereg
| From: | gem at rellim dot com | Date: | Fri, 30 Jan 2004 23:15:11 +0000 |
| Subject: | note 39509 added to function.ereg | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-64461@lists.php.net to get a copy of this message | ||
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)
----
Manual Page -- http://www.php.net/manual/en/function.ereg.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+39509
Delete -- http://master.php.net/manage/user-notes.php?action=delete+39509&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+39509&report=yes
Search -- http://master.php.net/manage/user-notes.php