Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
Mastering Regular Expressions by Jeffrey Friedl
ISBN 1-56592-257-3
Copyright 1997 O'Reilly & Associates, Inc.

Capsule Review

Excellent book. 5 stars out of 5.

Who should be interested in this book?

  • Anyone who works on a machine with Unix variant OS
  • Anyone who finds perlre too dry or daunting
  • Anyone who has always wondered what a regular expression engine was like under the hood but never bothered to try to read the code

Full Review

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.


In reply to Mastering Regular Expressions by splinky

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and all is quiet...

    How do I use this? | Other CB clients
    Other Users?
    Others studying the Monastery: (3)
    As of 2018-01-21 09:30 GMT
    Find Nodes?
      Voting Booth?
      How did you see in the new year?

      Results (227 votes). Check out past polls.