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 Expressions Cookbook by Jan Goyvaerts and Steven Levithan

Regular Expressions Cookbook was written by Jan Goyvaerts, webmaster of regular-expressions.info, and Steven Levithan, all-round JavaScript expert and long-time RegexBuddy aficionado. So instead of an actual review, I’ll just tell you what’s in the book, and let you make up your own mind.

The book covers the regular expression flavors .NET, Java, JavaScript, XRegExp, Perl, PCRE, Python, and Ruby, and the programming languages C#, Java, JavaScript, Perl, PHP, Python, Ruby, and VB.NET. After a quick introduction, the book starts with a detailed regular expressions tutorial which equally covers all 8 regex flavors. That chapter is followed by a detailed guide how to implement regular expressions in your source code, again covering the 8 programming languages equally. These chapters too are presented in cookbook format. You can easily pick out the task you want to accomplish when creating a regular expression of your own, and when you want to do something with a regex in your source code. While there’s some repetition, particularly in the programming guide, because of our goal of equal coverage, the benefit is that you can easily skip the parts on programming languages you’re not interested in, in true cookbook style.

The remaining chapters, over half of the book, present real-world problems, and how to solve them with regular expressions. These problems range from very simple problems and everyday regex tasks, to some complex problems that stretch the limits of what you can do with regular expressions, but show how a regex-based solution is often much quicker than doing the same in procedural code, particularly if you only need to do the job once. All the real-world problems also have solutions for all regex flavors. A few solutions add procedural code to make up for missing regex features, such as JavaScript lacking lookbehind. The book does not cover regex flavors with limited features such as the venerable POSIX standard. We didn’t want to put those flavors on the cover and then disappoint readers by saying “can’t be done with this limited flavor” for half of the recipes in the book.

Regular Expression Cookbook targets people with regular expression skills ranging from zero to upper intermediate, who want to learn about regular expressions for the first time, or sharpen their skills to become experts. Except for the chapter on programming languages, most of the recipes in the book don’t require programming skills to implement the solutions in EditPad Pro, PowerGREP, or any other text editor or search tool that uses one of the book’s regular expression flavors. The programming chapter assumes you’re familiar with all the basic features and syntax of your programming language, but it doesn’t assume you’ve ever used regular expressions in your source code.

Regular Expression Cookbook is intended to be the most practical book on regular expressions to date, filled with lots of detailed information about flavor-specific and language-specific features or issues glossed over by many other books and online articles. According to readers, it lives up to that promise.

If you’ve already worked through the regular expressions tutorial on this website, then you won’t find anything totally new to you in the tutorial part of Regular Expressions Cookbook, which takes up about 25% of its page count. But you’ll still find the other 75% of the book very worthwhile. Regular Expressions Cookbook has a comprehensive set of source code snippets in its programming chapter for all the languages it covers, while this website only has one page for each language. But what you really want to get Regular Expressions Cookbook for is the detailed presentation of regex-based solutions to real-world problems. If you like to learn by doing instead of reading tutorials, Regular Expressions Cookbook is highly recommended.