Quick Start
Tutorial
Tools & Languages
Examples
Reference
Book Reviews
Book Reviews
Regular Expr. Cookbook
Teach Yourself Reg. Expr.
Mastering Regular Expr.
Java Regular Expressions
Oracle Regular Expr.
Regular Expr. Pocket Ref.
Regular Expr. Recipes
Regex Recipes for Windows
More on This Site
Introduction
Regular Expressions Quick Start
Regular Expressions Tutorial
Replacement Strings Tutorial
Applications and Languages
Regular Expressions Examples
Regular Expressions Reference
Replacement Strings Reference
Book Reviews
Printable PDF
About This Site
RSS Feed & Blog

Regular Expression Pocket Reference by Tony Stubblebine (O’Reilly)

This pocket-sized 86-page booklet aims to be a reference for the regular expression functionality available in Perl, Java, .NET, Python, PCRE, PHP, JavaScript, egrep, sed, awk and vi. This is an impressive list of tools and languages. Unfortunately, I’ve found it to be the book’s weakness: in trying to cover all these flavors in such a small volume, it doesn’t really provide much information on any of them.

The first 10 pages of the book describe the various tokens or syntactic elements you can use in regular expression, along with a paragraph of explanation for each of them. It’s a useful refresher if you haven’t used regular expressions in a while, but don’t expect to really learn anything you didn’t know before.

The rest of the book covers the languages one by one, devoting about 10 pages to each. First there’s a table with the regex tokens supported by the language, and a one-line description of what the token does. Then the author describes the functions, classes and commands available in the tool or language. Each function or property has a one-line or one-paragraph description. There’s probably less information here than you can get by pressing F1 in your development tool. For each language there’s also a section describing its Unicode support (or lack thereof). This is quite useful, as Unicode support is one of the areas where modern regex flavors differ greatly.

There are very few examples in this book. It really is a quick reference. The author makes no attempt to teach you something you don’t already know. If you prefer to have your reference information on your desk rather than on your screen, this book certainly delivers. If not, you’ll probably find the help file that comes with your development tool or an online regular expression reference handier.

Personally, I believe O’Reilly should have split up this book into 8 volumes of similar size, one for each of the 7 major programming languages, and another for the UNIX shell tools described in this pocket reference. The separate volumes could then discuss the regex flavor of each language in greater detail, allowing the book to be used as a (quick) tutorial as well as a reference. Though you’d have to buy multiple books if you work with multiple languages, you’d get 8 times the information for each, which would very likely be all you need to comfortably use regular expressions. In fact, this is exactly what O’Reilly achieved with their excellent book Oracle Regular Expressions Pocket Reference for Oracle Database 10g.