Review of "Regular Expression Pocket Reference"

Oakland.pm

Reviews

Review of "Regular Expression Pocket Reference"

author: Tony Stubblebine

reviewer: George Woolley

Title: Regular Expression Pocket Reference
Subtitle: Regular Expressions for Perl, Ruby, 
          PHP, Python, C, Java and .NET
Author: Tony Stubblebine
Publisher: O'Reilly Media
Edition: Second 
Publication Month: July 2007
ISBN 10: 0-596-51427-1
ISBN 13: 9780596514273
Pages: 126
Cost: $14.95 USD, £9.50 GBP 

Short Review

Smiley Rating: Excellent. :) :) :) :) :) of 5

I recommend getting this book if you:

  • use regular expressions in 2 or 3 or more of the applications the book covers (Perl, Java, .Net, PHP, Python, Ruby, JavaScript, PCRE, Apache, vi, shell tools)
  • are proficient at using regular expressions
  • feel regular expressions are important to you
  • like concise references

As one expects from an O'Reilly Pocket Reference, this book is compact but still covers a lot of ground. For a whole bunch of applications, it provides

  • tables of various groupings of regex metacharacters summarizing their syntax and meaning
  • summaries of other regex related features but not in tabular form
  • examples
  • a few references in case you need to go deeper
  • and more

The information is concise and well chosen.

This is a reference, but in applications where you use regular expressions less, it may also be useful for expanding your knowledge significantly. It was for me.

If you wish, take a look at my somewhat more detailed review.

George Woolley
of Camelot.pm and Oakland.pm

Miscellaneous

Section Titles

  • Introduction to Regexes and Pattern Matching
  • Regular Expression Cookbook
  • Perl 5.8
  • Java (java.util.regex)
  • .NET and C#
  • PHP
  • Python
  • RUBY
  • JavaScript
  • PCRE
  • Apache Web Server
  • vi Editor
  • Shell Tools

Notes

Online Watch

Safari

When I looked (2007-08-31), this book was not on Safari Tech Books Online. :( However, I saw a number of other O'Reilly Pocket References including the first edition of this book.

References

I found some interesting online references using the following search:

online regular expression reference -oreilly

The -oreilly is so this book won't show up.

Or if you are searching for a reference for a specific language (or other application), you could include that in the search.

Tutorials

If you seek an online tutorial, you could use a search similar to that shown in the pevious subsection but replace reference with tutorial.

Somewhat Longer Review

Contents

The Title

Regular Expression

Regular Expressions can be viewed as a pattern matching language. Regular expressions exist in many computer languages, though the exact syntax and semantics varies somewhat from language to language. The origin of regular expressions is the work of Kleene in mathematics.

A regular expression can be used to identify a pattern in significantly different sequences of text.

If you don't already know what a regular expression is, you should probably not get this book.

Here's the first paragraph of the book which describes regular expressions: "Regular expressions are a language used for parsing and manipulating text. They are often used to perform complex search-and-replace operations, and to validate that text data is well-formed."

Pocket Reference

O'Reilly Pocket References:

  • are concise (and more abbreviated than books in the Nutshell series)
  • include syntax that an experienced user might want to look up
  • assume that the reader is experienced and competent in the domain covered

Does the title fit the book?

Yes. The book is certainly about regular expressions. And the book fits the description of a Pocket Reference given above.

About the Reviewer

Language Interests

I do a lot of manipulation of text and have a general interest in regular expressions. Consequently, I'm interested in the first two sections:

  • Introduction to Regexes and Pattern Matching
  • Regular Expression Cookbook

I've been using regular expressions in a Unix shell since 1989 and in Perl since 1994.

I've used the following recently (and am interested in regexes in them):

  • Perl
  • PHP
  • Ruby
  • vi
  • Shell tools (GNU egrep)

In the past I've made significant use of:

  • Java
  • JavaScript

All in all, I'm interested in most of this book.

O'Reilly

I own many O'Reilly books. I've made significant use of many O'Reilly books.

I've reviewed many O'Reilly books including several Pocket References.

Previous Edition

I read, reviewed and made use of the previous edition of this book as a reference.

If you wish, you are certainly welcome to take a look at my review of the first edition.

What You Get

By the Numbers

By the numbers what you get is:

  • chapters: 0
  • about this book section: 1
  • body sections: 13
  • general sections: 2
  • application sections: 11
  • index: 1
  • pages: 126

Above I use the word application broadly to include most software besides the kernel of an operating system.

Structure

There are no chapters. Basically the body of this book consists of 13 sections.

Application Sections: What I refer to as the application sections mostly consist of 4 or 5 subsections, though there is one section with only two subsections. In the case of Perl 5.8 the subsections are:

  • Supported Metacharacters
  • Regular Expression Operators
  • Unicode Support
  • Examples
  • Other Resources

Other sections typically have these subsections or a subset of them, though in the case of the second subsection the subsection heading may vary significantly.

The 11 application sections are from 6 to 13 pages long.

Relation to First Edition

The first edition of this book had similar sections, however in the first edition there were no sections corresponding to:

  • Regular Expression Cookbook
  • Ruby
  • Apache Web Server

Also, there are some updates since the first edition.

Relation to MRE

This book is a good companion for "Mastering Regular Expressions" (MRE). It has the same two owls on its cover as does MRE. :)

MRE only has separate chapters for:

  • Perl
  • Java
  • .Net
  • PHP

However, MRE does have a fair amount of coverage of Python, Ruby and PCRE even though there are not separate chapters on them.

The Pocket Reference makes many references to specific page numbers in the Third Edition of MRE.

Likes

Short

I like concise when that works for me, and this book works for me.

The Layout

I like the layout of this book which I described in the "What You Get" section above.

The About This Book Section

I think the "About This Book" and other material before the body is:

  • useful
  • well-written
  • and sets the tone well for the book

References to MRE

I like that the book has many references to "Mastering Regular Expressions", especially as I consider MRE to be one of the three best technical books I've ever encountered.

Using as a Reference

I like using this book as a reference. Because the book is short and well organized, I don't bother to use the index; I go to the section on the application I have a question about and look through the subsection that seems relevant.

When I tested that approach, it worked 12 times out of 12.

Includes Applications I Like

I like that the book covers a number of applications I favor.

Gripes

Index

I don't find the index to be of much use. I rarely use it.

However, for the index to be of much use to me, it would have to be way longer. And if the index were way longer, I'd be complaining about its length.

See "Using as a Reference" in the "Likes" section above.

Who's the Book for?

For

This pocket reference would be good for someone who has all the following characteristics:

  • uses and is competent with regular expressions
  • uses regular expressions in several different applications covered in the book (e.g. egrep, vi, Ruby, PHP and Perl)
  • sometimes forgets what is available in a particular application covered by the book and/or sometimes forgets the syntax of a specific feature in a particular application covered in the book

If the someone doesn't already own a concise reference for regular expressions, all the better. If they already know they like O'Reilly Pocket References, even better.

Not For

This book would not be good for anyone with any of the following characteristics:

  • doesn't use regular expressions
  • really wants (or needs) a tutorial instead
  • really wants a reference that goes into gory detail instead

Final Thoughts

This is an excellent and concise O'Reilly Pocket Reference covering regular expressions for a number of different applications. If you want that, get this book.

Complete Draft on the Web: 2007-09-02f

Minor Changes: 2007-09-03c

A Number of Minor Changes: 2007-09-11b

Removed Draft Status: 2007-09-12b