Stephen Ramsay’s Guide to Regular Expressions

Not a guide to negotiating the back-to-school barbecue, but a handy guide to manipulating text. Ramsay answers key questions like: Why should I care?  How can I improve my regex skills? Do I need anything to get started?

If you’ve ever typed “cp *.html ../” at the UNIX command prompt, or entered “garden?” into a web-based search engine, you’ve already used a simple regular expression. Regular expressions (“regex’s” for short) are sets of symbols and syntactic elements used to match patterns of text.

Even these simple examples testify to the power of regular expressions. In the first instance, you’ve copied all the files which end in “.html” (as opposed to copying them one by one); in the second, you’ve conducted a search not only for “garden,” but for “garden, gardening, gardens, and gardeners” all at once.

A .pdf version of Ramsay’s guide

Stephen Ramsay’s blog

Return to Top