The first six chapters of the book (283 pages) deal with regular expressions in general. Don't expect an easy-going tutorial here. While you could read "Mastering Regular Expressions" without prior knowledge on the subject, the book is really intended for people who already know the basics, and are ready to get the most out of regular expressions. You'll get more out of the book if you read through the regular expressions tutorial on this website first to get some experience.
The book doesn't focus on teaching you how to use regular expressions at all. It focuses on how to use them efficiently. Expect lots of detailed information on how the regular expression engine works on the inside, and how to take advantage of this knowledge. The book also compares various regular expression flavors, and their subtle differences.
Don't expect any handy reference tables or examples ready for copy-and-paste. This book (certainly the first six chapters) is definitely meant to be read (or should I say: studied) cover to cover. If you need a quick fix, this book is not for you. If you want lots of practical real-world examples, buy Regular Expressions Cookbook from the same publisher instead.
The final four chapters in this book each cover one of the four regex flavors that are probably the most widely used ones today. Though general programming books on these languages usually have a chapter devoted to regular expressions, you can't compare those with the chapters in this books. Other books give you an incomplete introduction to the regular expression syntax (which Mastering Regular Expressions covers in the first 6 chapters), and explain which functions and classes to use for common regex functions. The four language chapters in Mastering Regular Expressions, however, focus on the pitfalls and special features of each of the languages. They're too dense for programmers inexperienced with regular expressions or the programming language in question. But if you're ready to master your programming language, they offer a wealth of information.
Chapter 7 covers Perl and its many regex-related features and tricks. Regular expressions are a core part of the Perl language, forming an essential part of almost any Perl script. Here you'll learn everything that no other book on Perl (that I know) will teach you. Where general books on programming in Perl usually have one chapter with a regular expressions quick start, "Mastering Regular Expressions" shows you how to best use them with Perl.
The Java chapter covers the java.util.regex package in detail. This package is available in Java 4 (JDK 1.4) and later. The chapter tells you everything you need to know about the java.util.regex package, including the fixes and new features in Java 5 (JDK 1.5) and Java 6 (JDK 1.6). consists of two parts. There's a lot of detail here, which may overwhelm you if you're new to regular expressions. In that case, you'll probably want to get a copy of "Java Regular Expressions" by Mehran Habibi to go along with "Mastering Regular Expressions".
Chapter nine provides a good overview of the regular expression support in Microsoft's .NET framework, and how to best use it. This chapter provides a lot of information that is sorely lacking from the documentation included with the .NET SDK. While I wouldn't recommend buying this book just for the .NET chapter, "Mastering Regular Expressions" is certainly a good buy for .NET programmers wanting to get the most of their programming framework's excellent regular expression support.
The final chapter describes PHP's preg functions and the PCRE library they're built upon. The intricacies of all the PHP functions and the parameters they take are explained. The PHP chapter also explains PCRE's regex flavor, including PCRE's unique features such as recursive patterns. This book does not explain how to use PCRE in C/C++ applications.
When first published in 1997, "Mastering Regular Expressions" was the only book with solid information on modern regular expressions, particularly as implemented in Perl 5. It quickly became a must-read book for anyone who wanted to learn more about regular expressions. The first edition had a heavy emphasis on Perl.
The second edition (2002) was thoroughly reworked. It equally covers Perl, Java and .NET. The Java chapter covered a wide range of regex libraries for Java along the brand new (at that time) java.util.regex package.
The third edition (2006) is virtually identical to the second edition. The Java chapter now only covers the java.util.regex package, and does so in greater detail, as it made the other packages obsolete. There's also an extra chapter covering PHP's preg functions, and the PCRE library that the preg functions are built upon.
The links to Amazon on this page point to the third edition.
Mastering Regular Expressions was translated in several languages:
Unless PHP is your only language of interest, the 2nd edition is just as useful as the 3rd.
Did this website just save you a trip to the bookstore? Please make a donation to support this site, and you'll get a lifetime of advertisement-free access to this site! Credit cards, PayPal, and Bitcoin gladly accepted.
Page URL: http://www.regular-expressions.info/hipowls.html
Page last updated: 22 August 2013
Site last updated: 17 August 2015
Copyright © 2003-2015 Jan Goyvaerts. All rights reserved.
|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|
|Regular Expressions Quick Start|
|Regular Expressions Tutorial|
|Replacement Strings Tutorial|
|Applications and Languages|
|Regular Expressions Examples|
|Regular Expressions Reference|
|Replacement Strings Reference|
|About This Site|
|RSS Feed & Blog|