[wp-hackers] is_email

Robert Deaton false.hopes at gmail.com
Sat Mar 26 07:44:30 GMT 2005


I wonder how much of a slowdown it would be to validate e-mails with
that regexp. I'd imagine it can't be very quick, although, there've
been more surprising things.


On Sat, 26 Mar 2005 09:36:23 +0200, Nikolay Bachiyski
<nbachiyski at developer.bg> wrote:
> 
> Dougal Campbell wrote:
> > Because it's possible to have those characters in username and hostname
> > portions of email addresses.
> I appologize. I shouldn't have posted it before some investigation...
> 
> In particular, it's long been a convention
> > that many mail servers allow addresses like "user+whatever at example.com",
> > and automagically alias it to "user at example.com". This allows you to
> > generate your own dynamic aliases. It's useful for tracking who's
> > sharing your address. I often use that trick when supplying registration
> > information. For example, if I registered my email address with the New
> > York Times as "dougal+nytimes at gunters.org", then if I get spam to that
> > address later, I know that the Times shared my address (and I can
> > blackhole further email to that address if I want).
> Really nice. I didn't know it.
> 
> >> Here is a suggestion:
> >>
> >> $email_regex = '/^[a-z0-9_\-.]+\@([a-z0-9\-]{1,255}\.)+[a-z]{2,6}$/i';
> >
> >
> > I'm not sure why '.' was separated out, but I've seen people put '-'
> > outside of a character class due to bugs in some regex implementations.
> > I can't remember if PHP had that bug or not. If not, then I think your
> > suggestion would be a good one.
> >
> I haven't experienced any problems with a dash in a character class.
> Though I use it pretty often.
> 
> Nikolay
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
> 


-- 
--Robert Deaton
http://anothersadsong.com


More information about the wp-hackers mailing list