[geeklog-users] Suggested changes to lib-common.php/COM_isemail()
geeklog-users-admin at lists.geeklog.net
geeklog-users-admin at lists.geeklog.net
Sat Sep 6 15:12:00 EDT 2003
Bob wrote:
>Suggested change (incorporating everything above):
>
> if( eregi( "^[-_0-9a-z]+[-._0-9a-z]*\\+?[-._0-9a-z]*@[0-9a-z]([-
>.]?[0-9a-z])*\\.[a-z]{2,6}$", $email, $check ))
While playing around with this, I noticed that it does not accept
root at localhost
as a valid email address, while the old/current regexp does accept it
(again, probably due to the unescaped dot).
>I've tested this and it works, correctly accepting
>username+something at example.museum and username+ at example.museum and
>correctly rejecting username+ at exampleZmuseum and
>username+s+omething at example.museum. I'm not sure about the last case but
>I've never seen an address of this form before;
In my understanding of RFC(2)822, that last example would be valid, too.
PEAR's Mail_RFC822 class accepts username+s+omething at example.org, but
does not accept root at localhost :-/
>I know, someone could easily spend a month trying to make COM_isemail
>identify all legal email addresses
Yeah, it's a pretty complex matter.
I don't care about the case with more than one '+' too much, but I think
that domains without a dot should be accepted. My regexp-fu is a bit
rusty, what would the correct expression be? My first idea was ...(\\.[a-
z]{2,6}){0,1}$ but that accepts things like @blah.localhost ...
bye, Dirk
--
http://www.haun-online.de/
http://geeklog.info/
More information about the geeklog-users
mailing list