by Jeffrey Friedl
Regular expressions are the most useful tool in string manipulation going – but learning about them is a real pain. Essentially, they’re confusing for most folks because of an apparently opaque syntax, and because there are so many different ‘flavours’ of them.This book does more than anything else I’ve read to make all this clearer.
It’s a very ‘first principles’ book, looking at how regular expressions are processed, down to how they work through a string, character by character. This is useful, as it makes you realise how they work.
Later, it goes through more advanced features (lookaheads, etc.), and then it examines some of the most commonly used regular expression syntaxes – Java, .NET and Perl. It’s also got a lot of examples and good ideas on writing efficient expressions for the sort of stuff you do day to day – matching email, parsing arguments from the command line, that sort of thing.
At work, I’m our ‘regular expressions’ guy now, ‘cos I read this book, and I use it as a reference on a frequent basis. I also use regular expressions LOTS in my programming – and by God is it faster than writing code to process strings.
My only complaint – well, I wouldn’t mind a few wee examples in other languages – Javascript being the obvious one, and PHP and Ruby. They’re all VERY similar to Perl, so it wouldn’t take long to highlight any differences and explain how to use them.
However, it is a great book for the subject – just look at it on Amazon. My opnion? Every coder should read this book (or one just like it). Programming without Regexes is just crazy.