[wp-hackers] is_email
Nikolay Bachiyski
nbachiyski at developer.bg
Sat Mar 26 07:36:23 GMT 2005
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
More information about the wp-hackers
mailing list