regular expression recipes
How do you describe a pattern or locate a word in a sentence? With Regular Expressions -- a thankless feature that the most fundamental Unix and Linux tools have supported for years. Just think how painful your job would be if you couldn't fix a spelling error on the fly or watch a real-time log while ignoring any irrelevant information. Definitely not a fun thought.
The problem with Regular Expressions, though, lie in their complexity. Sure anyone can remember how to grep a string or list all files with the numbers 1 through 9 in them, but what if you needed to capitalize every word at the beginning of a sentence? Or what if you need to swap every third word with the second word in a paragraph? Again, not another fun thought.
Fortunately, there are people out there who enjoy solving such problems. And even better, some like to document them. While you can usually spend 5 minutes searching Google for the answer to a regex, having a printed reference can sometimes be more useful. Nathan Good has done just that -- and more.
Regular Expression Recipes contains exactly 100 regex examples. Now he could have just taken 50 pages, printed the problem, showed the solution and went on his way, but he didn't. Along with Perl, Nathan gave solutions in PHP, Python, vi, sed, and more. Not only that, but for each recipe he included a "How It Works" section. This was the best part of the book. It disected each Regular Expression piece by piece and explained what it was doing. So along with having 100 examples, you now have the ability to use them in over 5 different languages, and if you're the creative admin, you'll be able to understand each example and modify it to your needs. That kind of style is exactly what sets this book apart from a run-of-the-mill reference book. Sure you could flip to the page, figure out how to grep for a credit card number, and be on your way. But if you spend two more minutes reading the extra material, you'll close the book knowing how to grep a phone number too.
This book gets a 9/10.
