Regular expressions (”regex’s” for short) are sets of symbols and syntactic elements used to match patterns of text and they are pretty powerful. Regular expressions have been around for a very long time (in computer industry scale) and was first introduced as part of the powerful UNIX search tool grep.

The regex syntax used commonly today is compliant with Extended Regular Expressions (EREs) defined in IEEE POSIX 1003.2 (Section 2.8). EREs are supported by Apache, PHP4+, Javascript 1.3+, MS Visual Studio, MS Frontpage, most visual editors, vi, emac, the GNU family of tools (including grep, awk and sed) as well as many others. Extended Regular Expressions (EREs) will support Basic Regular Expressions (BREs are essentially a subset of EREs). The BRE syntax is considered obsolete and is only still around to preserve backward compatibility.

I believe mastering at least the most basic elements of regex is essential for any programmer. Further I know that having direct access to references, examples, ready to use patterns etc. is essential to speed up your work.

This is a toolbox for getting started and/or becoming more serious about regex. It provides details on commonly needed regexs that you can just pick up and use right away. Lets get started!

Read the rest of this entry »