Last Updated on March 28, 2018 by admin

If I wrote code all day, every day, I’m sure I could become really good at manipulating regular expressions. The obscure syntax is sort of Zen-like with a large dose of Perl obfuscation-fu. A one-liner that does a lot of cool text parsing appeals to the Nerd part of my DNA string. In reality, I have to grab my books when it’s regex time.

The classic is Jeff Friedl’s “Mastering Regular Expressions”, published by O’Reilly, but this week I ran across a copy of O’Reilly’s “Regular Expressions Cookbook” by Goyvaerts and Levithan (Amazon link for both here), It covers 8 different languages, including Ruby. Worth a look.

The Cookbook also led me to Rubular, a Ruby regex test page where you can try out your new regular expression against a test string, and view the results. Sure, you can do that with irb, but hey, you can’t have too many web sites in your Bookmarks pull-down, right?