Learning Ruby – Day 8

Day 8, What are regular expressions?

If you don’t know about regular expression matching, or regex, it’s basically a language to find the useful needles in haystacks of text and code. Think ‘find and replace’ turned to 11.

I do just enough regular expression matching to forget how it works. I always end up googling for a quick reference, not quit finding what I need. My text editor of choice, SubEthaEdit has a nicely-formatted pattern reference in the Help menu, though it lacks ‘How RegEx Works’ documentation.

Enter Day 8 of Teach Yourself Ruby in 21 days. Everything about regex is covered; groupings, greediness, repetition, alternators, everything. A while back, I was thinking of picking up one of the many books specifically covering Regex. Now, I’m sure this one chapter will serve me well as that reference.


This post documents my journey through Sam’s Teach Yourself Ruby in 21 days. I’ll be joining Al Abut in his effort to learn Ruby and blog along the way.