Although I run the risk of fawning all over this book here, Jan Goyvaerts and Steven Levithan’s Regular Expressions Cookbook (Second Edition) (O’Reilly, 2012) is a technical text that I will gladly describe using words like “essential” and “indispensable” and “invaluable”. It should be on every working programmer’s bookshelf, if not on her desk. It is exhaustive and rigorous, covering the major regex flavors across eight popular/widespread general purpose languages. If your work brings you in regular contact with regular expressions, then you need easy access to this book.
Later chapters (i.e., 4 through 9) look at more specific problems–e.g., performing validation on email addresses, dealing with Roman numerals, combing for text in the Apache Common Log Format, or parsing URLs. The recipes are all cross-referenced with each other, so if a particular solution really only solves about 75% of your problem, they’re prepared to point you in the right direction. They get right to the point, and then tell you where to go for more. What else can be said about these chapters except that they’re like the magnificent arsenal you’ll be wishing for when the text zombies swarm at your gate.
As I said before, if your work regularly brings you in contact with regular expressions, you’ll want to arm yourself with this. Highly recommended.
Disclosure: I received an electronic copy of this book from the publisher in exchange for writing this review.
UPDATE: (9/5/2012) I felt it was worth pointing out (as I did on Twitter):
@slevithan I tried to be more critical, I really did… 😉 (I hardly ever give out 5-star reviews)
— founddrama (@founddrama) September 4, 2012
- I should add “where appropriate” here, and note that the per-language sections in each discussion are much more common in the early chapters (2 and 3, with a pretty sharp drop-off starting in 4). This is because they’re covering the fundamentals, and there’s a lot more in the way of quirks and nuances to tread lightly around at this point. [↩]
- In other words: they remind you not to get too clever. “Sure you could do that as a one-liner… but no one’s going to know what that means next week. Not even you.” [↩]
- Which, validating an email address is not as easy as it sounds. [↩]
- Or as deep as you want, if you’re in to that sort of thing. [↩]