Email Regular Expression June 10, 2006
Posted by Lucanos in : javascript, programming, php, snippet , trackbackI found a site which had a very good regular expression to test email addresses, at http://www.codetoad.com/asp_email_reg_exp.asp.
However, one slight modification to their original test, which has been annoying me a bit as of late, is the addition of the plus symbol “+” as an acceptable character in the middle of the username section.
A terrific tool to test Regular Expressions is available at http://www.cuneytyilmaz.com/prog/jrx/. Well worth a visit.
The reason I have been using the “+” symbol and been running into lesser validators, is because GMail allows you to tack on tags behind your username to help you sort and manage your email inbox.
So I can subscribe to a newsletter with the address “lucanos+newsletter@gmail.com” (as “lucanos” is my GMail username) and then setup my GMail inbox rules so those emails are handled in a specific way.
It’s also a good way to identify sites which are selling your address, or spamming/ all you do, if required to provide an email address, is create one in the format “GMailUsername+SiteDomain@gmail.com“. Then, if I get spam to that specific email address I know where they got it from, as the culprit’s name will be included in the destination address.
Pretty tricky, hey?
Comments»
tank you.
very usefull.