|Do you know where your variables are?|
Mastering Regular Expressionsby splinky (Hermit)
|on Jul 09, 2000 at 00:27 UTC||Need Help??|
Order Mastering Regular Expressions
Excellent book. 5 stars out of 5.
Who should be interested in this book?
Mastering Regular Expressions by Jeffrey Friedl is, without a doubt, THE book about regular expressions. To my knowledge, there is no other book devoted specifically to the subject, nor need there be now that Jeff's taken care of the matter.
The next time you're in the book store wondering whether to buy it, pick it up and turn to Tables 6-1 and 6-2, titled, "A Superficial Survey of a Few Common Programs' Flavor" and "A Comical Look at a Few Greps", respectively. If, after perusing these nuggets, you still don't think you need the book, then just walk away. I can think of no more persuasive argument. That page is bookmarked with a Post-It in my book, but it's completely unnecessary because the book naturally falls open to that spot. I use it that much.
The book opens with a couple of chapters that introduce the reader to regular expressions. Good examples and clear prose bring the subject down to a level where any competent programmer can understand it. But be sure to read the typographical conventions in the Preface. Otherwise, you may wonder what language the examples are written in.
The two most useful sections of the book for most Perl programmers will be Chapter 5, "Crafting a Regular Expression" and, of course, Chapter 7, "Perl Regular Expressions". As you read Chapter 5, you'll probably be surprised by how much you DON'T know about creating a functional and efficient regular expression. And Chapter 7 is, without a doubt, the most comprehensive discussion of Perl's particular regular expression features that you'll find anywhere.
Chapter 4, "The Mechanics of Expression Parsing", will separate the casual, 40-hour a week programmers from the REAL programmers. In this chapter, you'll learn exactly how regular expression engines work. By the end, you'll know your DFAs from your NFAs, and you'll be able to talk bump-along and backtracking with the best of them. And when someone mentions POSIX regular expressions, the words "Longest leftmost" will be out of your mouth before you know what happened.
The rest of the book is mostly tool-specific information. TCL, AWK, and GNU Emacs are covered in depth, in addition to Perl.
So, is there anything wrong with this book? Well, yes, I suppose there is. First, if anything, it covers its subject TOO thoroughly. I mean, let's face it, most people aren't going to be terribly interested in Chapter 4. I liked it, but I'm kinda weird that way. The majority of people could make do with chapters 1 and 2, and maybe 7 if they do Perl regularly.
The second problem is that chapter 7 is a little dated at this point. I would hate to be an author trying to keep up with Ilya Zakharevich's enhancements to the Perl regular expression engine. Fortunately, most of Ilya's major enhancements are very advanced features which most people will never understand well enough to use, so chapter 7 will continue to serve most people just fine. Still, I'd love to see Jeff come out with Revision 2 at some point.
But until and unless that happens, my well-worn copy of MRE will remain close at hand for the foreseeable future. Why? Because Perl's regex features may continue to grow and expand, but Table 6-1 will be relevant as long as Unix variants exist in the world.