Re: Email validation

From: Date: Fri, 14 Jun 2002 09:08:51 +0000
Subject: Re: Email validation
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-102191@lists.php.net to get a copy of this message
That one does not accept '+'. In fact, that was the 1st time I ever saw such a character in an e-mail address. I did not check the RFC, but if it is valid, just add the '+' char to the reg. exp. like this: function mailCheck($strEMailAddress) { return eregi("^[_a-z0-9+-]+(\.[_a-z0-9+-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)+$", $strEMailAddress); } This should now accept your mail address. Regards, Pedro Alberto Pontes ----- Original Message ----- From: "Timothy J. Luoma" <luomat@peak.org> Newsgroups: php.general To: "Pedro Pontes" <ppontes@myrealbox.com> Cc: <php-general@lists.php.net> Sent: Friday, June 14, 2002 04:49 Subject: Re: Email validation > On Wed, 12 Jun 2002, Pedro Pontes wrote: > > > function checkEmail($strEMailAddress) > > { > > return eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)+$", > > $strEMailAddress); > > } > > > > You have it now :). > > I'm still learning my PHP regex... does the above allow someone to have a > literal "+" in their email address, ala <luomat+php@peak.org> which is > perfectly valid, but often rejected by "email validators"? > > TjL > > >

« previous php.general (#102191) next »