Short Review and RecommendationMastering Regular Expressions, 2nd Edition
Notes:
Exceptional :) :) :) :) :) of 5 If regular expressions are important to you, get this book. "Mastering Regular Expressions" is exceptional both in the scope of what it covers regarding regular expressions and also in it's thoroughness. To date this is the most impressive technical book I've read on any subject. It's a virtuoso performance. One caveat: parts of the book are quite demanding. See my longer review for more detail. George Woolley of Oakland.pm [top] MiscellaneousChapter Titles
Notes:
[top] Fun Quote"with Perl, you become skilled by repeatedly shooting yourself in the foot." Notes:
[top] A Related ReferenceNotes:
[top] A Related ArticleFive Habits for Successful Regular Expressions Notes:
[top] |
Longer ReviewContents
Note:
Note:The Titlethe meaning of the title: The book "Mastering Regular Expressions" doesn't belong to an O'Reilly series. So I don't have that to guide me in interpreting the title. However, the author is quite helpful regarding this. According to the author the book provides the information needed to acquire a "full command" (that's roughly synonymous with mastery to me) of regular expressions. It is the author's intent that the book also provide the motivation to use the information to acquire that "full command". I gather that for the author "information" includes:
but also
does the author deliver? I don't know whether the book contains enough information to master regular expressions. If I ever feel like I'm in "full command" of regular expressions, perhaps I'll have an opinion. What I can say is that I know of no other book on regular expressions with comparable scope and detail. Does the author provide the motivation to use this information? Again, I can't say. What I can say is that the author sure motivated me. The book was quite difficult for me at times, but I've now been through all of it. Some of the things contributing to my motivation have been:
[top] About the ReviewerBiases: Some of my biases that could effect this review are
If you want more detail, take a look at the "About the Reviewer" section of my review of the article "Five Habits for Successful Regular Expressions" by Tony Stubblebine. Oh, I own the first edition of the book being reviewed here and consider it excellent. I thought it was so good, that I bought a second copy so I could have one copy at work and one copy at home. Expectations: What I was hoping for in this book was
[top] Relation to First EditionThe first edition came out in 1997, the second in 2002. That's a period of five years. There were many advances in regexes during that period. Perl regexes evolved. Java, which didn't have regexes at all in 1997, got them in spades in 2002. Many languages that had regexes upgraded them during that period. And some new languages (like Ruby), that came into being during that period, support regexes. If you have the first edition, you'll find much that's familiar in the first seven chapters. You'll also encounter many changes and additions to reflect the changes that have taken place. And chapters 8 and 9 on Java and .NET regexes are entirely new. The following table gives a crude picture of the relationship between the chapters of the first and second editions.
Notes:
[top] What I Learned about Writing RegexWell, I learned a great deal. Even before this review was complete, I began using the following in some of my Perl code:
Before reading this book, I was unaware that I could embed code in regexes and I was only vaguely aware of the qr operator. Both are explained in a clear way in the book and there are examples. my point: Well, for all I know, you already use emedded code and qr. Still, I suggest taking a look at this book. Or maybe Perl isn't the world you do regexes in. Well, the book also covers Java and .NET and much more. And it becomes clear reading the book that as far as regex features are concerned other languages are competitive with Perl. Perl has a prominent place in this book, but this is definitely not a Perl book. Well, I learned a lot, and I am already putting some of what I learned to use. [top] What I Learned about Teaching RegexFrom time to time, I get an opportunity to help a novice Perl programmer become more proficient at Perl programming in general and using regexes in particular. Reading "Mastering Regular Expressions" has put me in a better position for doing that. Below I briefly talk about two ways I expect the book to help me in this regard. The Language Analogy: The language analogy Friedl puts forward in the book has been helpful to me, and I believe it would also be useful to novices. Here's the picture I have from the language analogy. Perl is a programming language which includes regular expressions which are a language which includes character classes which are a mini language. It's important to recognize that these three languages are (beautifully) integrated together in Perl. It's also often useful to recognize them as three languages. In this context, here's something Friedl says about character classes that I've found useful: "Consider character classes as their own mini language. The rules regarding which metacharacters are supported (and what they do) are completely different inside and outside of character classes." And the author gives concrete examples of this. "Mastering Regular Expressions" as a reference: I have become convinced that this book could be useful for a Perl novice who:
For such a person, I'd suggest the following use of the book:
my point: My point is that this book can be useful to you in helping novices. The above are just two of a number of things I expect to be useful in teaching the regex novices I encounter who, it happens, are also typically learning Perl. Hey, you may live in a Java-centric world. What I'm saying is that there is valuable material here for a novice and for people who are oriented to helping novices. I'm thinking this might be missed by some given that parts of this book are quite advanced. [top] GripesTo keep things in perspective, this is the most impressive technical book I've read to date on any subject. But I can always find something to gripe about. testing: IMO, you can't master regex without becoming effective at testing them. But this is not much addressed in the book. There's not a separate section on testing, nor even an index entry. One thing that Friedl does point out is that it's a good idea to watch out for unwanted matches. The article I mentioned earlier by Stubblebine does begin to address testing regular expressions. clerical errors: For whatever reason, there are an unusual number of typos in the book. However, none of the typos I encountered seem to me likely to mislead. Perl 6: Perl 6 is mentioned in the book; but Perl 6 rules are not discussed, even though they rock. Perl 6 rules are evolutionary descendents (or perhaps I should say revolutionary) of what we call regular expressions in Perl 5, though I gather regular expressions in Perl and other computer languages long ago ceased to be regular expressions in mathematical terms. Hm, Apocalypse 5 on "Pattern Matching" is dated June 4, 2002 and the second edition of "Mastering Regular Expressions" came out July 2002. Given the timing, any gripe here is unrealistic. Also, as of the writing of this review (in January/February 2004), Perl 6 has not yet been released. [top] Who is the Book for?I recommend this book for anyone who
You don't have to be a regex whiz to read this book. However, the book is demanding, if you aren't serious I wouldn't bother getting it. Depending on your regex background, I have different things to say:
This is an impressive book. If you got all the way through this review, I suggest you have enough interest to get it. [top] |
Last Updated: 2004-02-05