Book Review: Regular Expressions in 10 minutes
Regular expressions have always been a bit of a mystery to me. I knew they were very powerful, but they've never been very intuitive. In the past, I've been fortunate to work with developers who could build them for me. I also have the book Regular Expression Recipes: A Problem-Solution Approach, and as a last resort, I've used RegExLib.com
Eventually, I realised that I needed to learn Regex properly, so I bought Regular Expressions in 10 minutes by Ben Forta
There are more detailed books on Regular Expressions, but I wanted something to get me up to speed quickly. I could worry about more complex problems once I'd mastered the basics.
This book is split into 10 chapters, each with around a dozen pages. Each chapter focuses on a different aspect of regular expressions, and has plenty of real-world examples.
Regex tester code is available to download from Ben's website in a number of languages, and there are several useful appendices, detailing the regex support in different languages, and some common regex patterns.
I found the length of the chapters to be well waited, and I could fit in one or two a day easily without losing concentration. Repeating the examples using the Regex tester code helped the lessons sink in. Within a few days, I'd finished the book, and I don't find regular expressions scary any more. I'd also realised that regular expressions can do a lot more than simple search and replace.
It will take a bit more practice before I could say I've mastered Regex, but this book will be a handy reference along the way.
There are a few minor niggles with the book that stop it getting 10/10:
- I'd recommend downloading the errata from Ben's site, as there are a few regex typos which can be confusing.
- I was using the ColdFusion version of the Regex tester, and some expressions can mess around with the rest of the page code.
- The book is a bit old now, so some of the example code (e.g. HTML snippets) looks dated.
In summary, this is a great book to learn regex fast. If like me you've been avoiding regular expressions, this book will ease you in gently.
Author | Ben Forta |
---|---|
Publisher | Sams (March 2004) |
ISBN | 0-672-32566-7 |
Rating | 9/10 |
One should not forget that livedocs - http://livedocs.adobe.com/coldfusion/8/htmldocs/re... - give pretty good coverage to CF's implementation of regexes, too. It's easy to understand, and complete. It's perhaps a bit light on examples though.
--
Adam