visit O'Reilly's page for this book
Mastering Regular Expressions
Third Edition
534 pages, August 2006, O'Reilly Media, Inc. Hip-looking owl


This is the web site for the third edition of Mastering Regular Expressions, by Jeffrey Friedl.

It's available from O'Reilly Media and, among many others.

Mastering Regular Expressions has been released in a number of languages:

visit O'Reilly's page for this book
1st, 2nd, and 3rd

1st and 2nd

1st, 2nd, and 3rd

1st, 2nd, and 3rd

1st and 2nd


1st, 2nd, and 3rd

There may be others... I'm not necessarily told when a new translation is published, so please let me know if you notice another.

Wondering about the book?
Here are some things that can help you learn about the book.

What's New
New in the Third Edition are a new chapter on PHP (and upgraded PHP coverage throughout the core chapters), and a completely rewritten Java chapter to reflect changes from Java 1.4.0 to Java 1.5/1.6. Otherwise, there are only minor updates and typo fixes. (For example, if your interest is Perl or .NET, there's little new in the Third Edition that's not in the Second Edition.)

The changes from the First Edition are all-encompassing — the Second Edition was essentially a new book. If you have the First Edition and would like to know what changed (summary: everything), see this article at the O'Reilly Network.

What's Not New
What hasn't changed is the exhaustive research that went into it, the attention to detail, the breadth and depth of coverage, and the careful typesetting. (I did all the production myself, typesetting every speck of ink on every page that has a page number, in all three editions.)

It's not “Just for Perl”
The first edition contained a 100-page chapter devoted to Perl, so many who merely glanced at it assumed it was a book on Perl regular expressions instead of the general book on all regular expressions that it was. The “Perl blue” cover perhaps helped reinforce that idea. However, let me assure you that while all three editions do have huge chapters devoted to Perl, their bulk are on general and language-specific (besides Perl) content.

The Third Edition contains language-specific chapters on Perl (82 pages), Java (40 pages), .NET (34 pages), and PHP (46 pages). The first six chapters on general concepts take 282 pages. The table of contents, preface, index, etc. take up the remaining 50 pages.

Table of Contents
Here are the Third Edition's Table of Contents, as well as the Second Edition's Table of Contents. They'll give you a good feel for what each edition covers.

Back-Cover Sales Blurb
Here's the back-cover copy that's supposed to get you excited about the book.

Check It Out at Your Library
Ask for it at your library. The Third Edition's ISBN is 0-596-52812-4.

Already Have the Book?
Here are some things that might be useful.

Full Index
Here's a link to the full index for the Third Edition, as well the index for the Second Edition. They're large pages, suitable for searching via your browser's search function.

Here's the errata for the Third Edition, and errata for the Second Edition.

Program and Data Listings

You can fetch program and data listings from one page, or from a range of pages.
Edition:   3rd    2nd
Fetch listings from page (a number, a dash-separated range, or the word “all”)

How to obtain egrep.

You might find this cover spoof funny.


I couldn't do it alone. Here's a copy of the Personal Comments and Acknowledgments, lifted right from the book.

just peeking