Writing the regular expression

Albeit rare emails that take the appearance of an IP address, I’m going to deal with the most common format of moc.elpmaxe|resu#moc.elpmaxe|resu. Email addresses are free so I don’t mind giving someone the shaft when they try plugging in something like 441.33.54.302|321#441.33.54.302|321.

So, let’s look at the most common email regular exression:
Common Email Regular expressions


This pattern matches anything that has ‘one of more of’ a through z (lowercase and/or uppercase), 0 through 9, an underscore (_), a dot (.), or a hyphen(-)…. Then followed by a required @ symbol. Then followed by (a through z (upper and/or lower), and/or 0 through 9, and/or a hyphen) followed by a required dot (.). Then lastly followed by an alpha-numeric string that is 2 to 4 characters long.

Ok, take a deep breath. What’s missing?. That ‘addition’ symbol. So without looking too much farther, and without having to explain it all over again, here is our revised regular expression.
Revised and New Regular Expression


This now allows Gmail users to add their filtered addresses such as user+moc.liamg|retlif#moc.liamg|retlif. I hope this short tip was helpful. Enjoy!

O ile nie zaznaczono inaczej, treść tej strony objęta jest licencją Creative Commons Attribution-ShareAlike 3.0 License