Take the guesswork out of using regular expressions. With more than 140 practical recipes, this cookbook provides everything you need to solve a wide range of real-world problems. Novices will learn basic skills and tools, and programmers and experienced users will find a wealth of detail. Each recipe provides samples you can use right away.

Jan Goyvaerts

Jan Goyvaerts runs Just Great Software, where he designs and develops some of the most popular regular expression software. His products include RegexBuddy, the world's only regular expression editor that emulates the peculiarities of 15 regular expression flavors, and PowerGREP, the most feature-rich grep tool for Microsoft Windows.

Steven Levithan

Steve Levithan works at Facebook as a JavaScript engineer. He has enjoyed programming for nearly 15 years, working in Tokyo, Washington D.C., Baghdad, and Silicon Valley. Steven is a leading JavaScript regular expression expert, and has created a variety of open source regular expression tools including RegexPal and the XRegExp library.

The subtitle of the book is "Detailed Solutions in Eight Programming Languages". Those eight languages are C#, Java, JavaScript, Perl, PHP, Python, Ruby, and VB.NET. This shows the major issue which I have with the book: no C++ even though C++11 standard brought built in regex support. The standard was approved on 2011 and book was released 2012, so it should have been incorporated, but there is only slight hint of it, Boost-, and PCRE-libraries in few paragraphs covering C and C++.

Nevertheless the book is still very useful for C++ programmers as the recipes are about regular expressions and the languages are in a side role. (Though there are things which are easier with some languages and some things are harder with other languages, and the examples show this nicely.)

I always find it praiseworthy to say that the description of the book on the O'Reilly page and the back cover text of the book are in harmony with the actual contents of the book. Remember to check the sampler here in order to see what is in the book and for the style of the text. The book covers multiple regex "dialects" and on every recipe it tells what works in which dialect if there are differences. The book also follows the standard O'Reilly notation and it is also easy to see if text in question is example or normal text. In pdf version the working links in text are nice addition as the book is 600+ pages and browsing it is a bit of work.

Each recipe starts with problem description, next in line are the solutions in multiple languages and dialects (if needed), then comes discussion section explaining the solution and possible issues and finally see also section with links to other recipes with similarities to recipe in question. The book starts from basic regex skills so novices get full benefit of the book but it also covers rather complex regex tasks so I'd say that even seasoned regex users can benefit from the book, especially if they are forced to change regex dialect they have been using.

Disclaimer: I received a free review copy of this work through the O'Reilly Blogger Review Program.

Some people, when confronted with a problem, think, "I know, I'll use regular expressions." Now they have two problems.—Old Regex Proverb

Among casual programmers, regular expressions maintain something like the status of the old Celtic ogham: forbidding to the uninitiated, yet redolent of secrets and deep magic. Like Perl, which helped popularize them, they are among the clearest examples of "write-only" code — devastatingly effective for those who concoct them, unparseable by everyone else.

But it doesn't have to be this way. Goyvaerts and Levithan, the minds behind regular-expressions.info, have written a regular expressions cookbook that not only lays out clear recipes for the most common regular expressions tasks, but serves as a concise (and precise) introduction to the features of modern regex across eight different languages.

That's right. If you are coding in C#, VB.NET, Java, Javascript, PHP, Perl, Python, Ruby, or a language that shares these dialects, explicit code is available to help you validate common inputs, parse URLs and Markup languages, and search text. As other reviewers have noted, however, if you are using POSIX regex, you will have to muddle through, since this variant is not covered.

As someone who had written a handful of regular expressions with great difficulty, I got a lot of benefit from reading chapters 2 and 3, which cover basic regular expressions (a lot more than basic, in fact) and syntax for using regex in various programming languages. This alone is probably worth the price of admission. Some might prefer a gentler introduction, but no real background in regex theory is required (though some is helpful for understanding optimizations suggested in specific recipes), and the straight-ahead problem-solution format will likely be enough to get those with programming experience up to speed.

Chapters 4 through 9 consist of recipes for various common regex tasks, complete with useful variants, illustrative examples, and workarounds for regex dialects lacking some useful modern features (we're looking at you, Javascript). As the authors note, this section is best used as reference or sipped occasionally, rather than read straight through.

The authors do have products to flog, but some of them are free, and all of that is harmlessly relegated to the first chapter.

I found the book tremendous both as a self-contained introduction and a cookbook, though those with very limited programming experience may opt for an introductory text first (the authors' own introduction at regular-expressions.info is pretty decent). In my experience, careful reading of the early chapters (2 and 3) got me a long way toward being able to "sight-read" the later recipes, which I consider a success. At the very least, I have a solid reference to grab next time I have a problem requiring regular expressions, one that I hope will prevent me from creating that second problem.

've always been a fan of the 'Cookbook' series of books: it's the information I want, when I want it, without the fluff. This book definately does not disappoint. Here's how the book is laid out:

1. Present the problem.2. Present the solution3. Present the solution if it's different in .net, java, pcre, etc.

While the earlier chapters deal with the basics and some theory, this book is geared more to regex veterans. Regardless, it's a great addition to my 'essentials' shelf. Highly recommend to any professional who deals in regular expressions daily.

I typically refer to it for solutions to specific problems which is how I generally like to read cookbooks rather than from cover to cover. I especially like how the different flavors of regexes are contrasted in the myriad of examples therein. There's something for everyone from relative newbies to aficionados.

The Regular Expressions Cookbook has been great for using with my job as a systems administrator. As I've made various little scripts to manipulate user data, I've used tips and tricks to speed up my writting process. And as I've been getting into a programming career, it's been great for showing me examples for me to speed up my coding skills.

As a seasoned programmer who must occasionally write regular expressions in a smattering of languages (e.g. Perl for build tools), I find this book very helpful, well organized, and a good reminder of the annoying differences in various flavors of regular expressions. Has saved me tons of time.

By that I mean I find regular expressions useful and powerful, but I don't find the puzzle aspect of them fun. This book has enough explanation so I know how some aspect works and examples to lead the way to m better understanding. When I am writing something that needs REs, this book is open on my screen.