Have one to sell?
Flip to back Flip to front
Listen Playing... Paused   You're listening to a sample of the Audible audio edition.
Learn more
See this image

Regular Expressions Cookbook Paperback – Jun 1 2009

5 out of 5 stars 1 customer review

See all formats and editions Hide other formats and editions
Amazon Price
New from Used from
"Please retry"
CDN$ 142.52 CDN$ 17.67

There is a newer edition of this item:

Regular Expressions Cookbook
CDN$ 59.13
In Stock.

Save an Additional 10% on Textbooks When you Join Amazon Student

No Kindle device required. Download one of the Free Kindle apps to start reading Kindle books on your smartphone, tablet, and computer.

  • Apple
  • Android
  • Windows Phone
  • Android

To get the free app, enter your e-mail address or mobile phone number.

Product Details

  • Paperback: 510 pages
  • Publisher: O'Reilly Media; 1 edition (June 1 2009)
  • Language: English
  • ISBN-10: 0596520689
  • ISBN-13: 978-0596520687
  • Product Dimensions: 17.8 x 3 x 23.3 cm
  • Shipping Weight: 816 g
  • Average Customer Review: 5.0 out of 5 stars 1 customer review
  • Amazon Bestsellers Rank: #554,841 in Books (See Top 100 in Books)
  •  Would you like to update product info, give feedback on images, or tell us about a lower price?

  • See Complete Table of Contents

Product Description

Book Description

Detailed Solutions in Eight Programming Languages

About the Author

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 is a leading JavaScript regular expression expert and runs a popular regular expression centric blog athttp://blog.stevenlevithan.com. Expanding his knowledge of the regular expression flavor and library landscape has been one of his hobbies for the last several years.

Inside This Book

(Learn More)
Browse Sample Pages
Front Cover | Copyright | Table of Contents | Excerpt | Index | Back Cover
Search inside this book:

Customer Reviews

5.0 out of 5 stars
5 star
4 star
3 star
2 star
1 star
See the customer review
Share your thoughts with other customers

Top Customer Reviews

By bernie TOP 50 REVIEWER on Oct. 29 2013
Format: Paperback
I have several Regular Expressions books; most of them are from O'reilly.
However the others are more focused on various unix/c environments.

Yet one cannot concentrate on operating system and ignore what they operate on. This book covers a wider environment that is encounter mostly in websites and occasionally in specific industries (C#, Java, JavaScript, PHP, Perl, Python, Ruby, and VB.NET.) You learn that regular expressions even though indispensable are not necessarily uniform in syntax.

You can tell that this was not written in a laboratory or an ivory tower and the recipes are not just practical but the ones you will be challenged within the real world.

Do not tell anyone but I have fun reading this book in advance of a change to see the possibilities be for the questions arise.

While you are being mesmerized by regular expressions you are also being exposed to different environments; some you will be familiar with and others will make you say where have I been? To name a few various editors, the different languages themselves if you have not had a chance to experiment, each chapter tattle is a different concept or valid reason to use regular expressions.
Was this review helpful to you? Yes No Sending feedback...
Thank you for your feedback.
Sorry, we failed to record your vote. Please try again.
Report abuse

Most Helpful Customer Reviews on Amazon.com (beta)

Amazon.com: HASH(0xb8de5480) out of 5 stars 26 reviews
30 of 31 people found the following review helpful
HASH(0xb8de3ec4) out of 5 stars At last a Use Case based RegEx Book June 7 2009
By Bob Reselman - Published on Amazon.com
Format: Paperback
As much as I hate to admit it, regular expressions are hard for me. My need to use them is situation specific and I never really took the time to master them conceptually. So, when it comes time create one, I have to grope around to figure out how to meet the need at hand.

This book is really made for a person like me. The structure is problem-solution based. And, every problem is numbered in outline format. Thus, referencing back is an easy affair.

Want to know how to find bold text in an HTML file? This book will tell you how.

Want to learn how to split a sting using a regular expression? This book tells you how.

The book discusses solutions generally and in language specifics. It supports C#, Java, Javascript, Ruby, Python, PHP, Perl, VB.NET.... the entire cast of the usual characters. (No pun intended.)

The writing is clear. You can take things in a bit at a time. And, that some of the problems use those 'hard to get concepts', the topical discussions actually teach you the difficult concepts in a manner that is pretty easy to understand. Sometimes you might have to go over a section of few times to get full understanding. But the review is not a chore.

This is a good, useful book. It's helping me to become a better engineer. And believe me, I need all the help that I can get! :)
17 of 18 people found the following review helpful
HASH(0xb8de3f18) out of 5 stars Goes further and deeper than many tutorials on regular expressions June 21 2009
By OnceMore - Published on Amazon.com
Format: Paperback
This excellent book goes further and deeper than many tutorials on regular expressions. You might be surprised with some of the things you'll learn from reading it.

Unlike many cookbooks, this one doesn't dive into the recipes right away. I thought this was a good call because regular expressions are a specialized topic, and most developers don't work with regular expressions on a daily basis so they probably have to be reminded of the building block concepts and syntax, and get prepared for a discussion of more advanced features. Chapter One provides a list of recommended tools for working with regular expressions. Chapter 2 is a concise but very thorough discussion of building block and more advanced regular expression concepts (e.g., possessive quantifier or atomic grouping, named capturing groups, lookahead and lookbehind, etc.), including a discussion of differences in engine implementations and feature support. Chapter 3 is a hundred-plus page tutorial on how to work with regular expressions using different programming and scripting languages, including potential gotchas and workarounds. Chapters Four through Eight contain the recipes for solving real-world problems, with tips on how to improve an initial solution's readability (e.g., use named capturing groups when possible, etc.) and/or efficiency.

I was initially skeptical about the authors' ambitious goal of covering so many regular expression flavors, thinking the discussions of differences in engine supported features might prove distracting. The book is written and organized so well, however, my fear did not materialize. In fact, I was pleasantly surprised to learn that: of the covered flavors, Microsoft's DotNet regex engine supports some of the most advanced features.

There's not much to dislike about this book but if I were asked to suggest one or two things that might be of value-add to readers, I would suggest making available for download files containing appropriate subject strings for testing the book's various recipes as a convenience to readers who learn best by doing and want to follow along as they read the recipes, and for the book to include, for easy reference, a feature-support comparison matrix of the covered flavors, much like the comparison table available in the regular-expressions.info website.
11 of 12 people found the following review helpful
HASH(0xaaffc36c) out of 5 stars We Have Been Waiting for This One June 9 2009
By Brett Merkey - Published on Amazon.com
Format: Paperback
I was getting set to write a review of this book, when I happened to visit one of the blogs I regularly read -- Coding Horror. Jeff Atwood says it all for me so please take a look at what he has to say.

If you are a serious programmer or even if you are a Web GUI design person forced to do a bit of JavaScripting like me, you are going to run into situations where using a regex engine is the appropriate tool. Regular expressions are not easy to learn and are kind of boring. They are also very powerful.

Most of us learn faster by doing -- and that most often means working from code we or someone else has done before that does something a bit like what we want to do but needs some tweaking or extending or generalizing. If you are like me, you already have a collection of regular expressions to help in this process. This book does better than that by collecting hundreds of examples together in ways that build your understanding while never getting abstract or divorced from the real problems we face.

Your shelf has a place for this book. Recommended.
4 of 4 people found the following review helpful
HASH(0xaaffc738) out of 5 stars Jan is a regex guru! June 26 2009
By ridgerunner - Published on Amazon.com
Format: Paperback Verified Purchase
Preface: When I first dove into regular expressions two years ago, I jumped in head first with Jeffrey Friedl's classic: "Mastering Regular Expressions - 3rd Edition" (MRE3). I've read it twice so far and it is truly a masterpiece (very highly recommended). As I was learning to "think in regex", I needed some reliable tools with which to practice my newfound regex skills (I'm primarily a Windows guy). Although my text editor of choice at the time had three flavors of built-in regex support (UltraEdit32), its support for Perl compatible syntax had a few inconsistencies. A search for better regex tools led me to the EditPad Pro text editor and RegexBuddy, both from "Just Great Software" (JGSoft). These tools proved to be so well designed, bug-free and useful, that I decided to purchase the much more expensive PowerGrep (and was blown away with what I can do with that!) Armed with these tools and my newfound mastery of regular expressions (courtesy of MRE3), I now feel that I could conquer nearly any challenge from the world of text processing. I was very impressed with the quality, accuracy and attention to detail of all the JGSoft's software products, and when the author of these tools announced that he had a new book coming out on regular expressions, I pre-ordered it sight unseen. I knew it would be good. And it is. (Note that I am not affiliated in any way with JGSoft, I am just a very happy user of their software.)

Review: Jan Goyvaerts is one of the world's experts in the field of regular expressions. He is an "attention to details" and "we will serve no wine before its time" kind of guy, so I was not surprised to find "Regular Expressions Cookbook" well organized, accurate, easy to read, and having very few typos and/or grammatical errors. As far as I could tell (and I'm very nit picky), the recipe regexes presented are both accurate and efficient. Each recipe begins with a statement of the problem, the regex solutions, and then followed by an in-depth discussion/explaination of what is going on inside each regex component. And for each "recipe", multiple regexes are typically provided covering a spectrum of specificity (starting with general "easy-matches" moving to the more specific). And regexes are provided for each of the many supported flavors (i.e. .NET, Java, Javascript, PCRE, Perl, Python and Ruby), complete with the required regex modifiers/options. And where appropriate, footnotes are provided that further describe the peculiarities regarding a specific regex flavor. Attempting to cover all modern regex flavors in one book was a tall order, but this book does it well. In addition to the many regex flavors, Chapter 3 covers regex handling with many different programming languages (C#, VB.NET, Java, Javascript, PHP, Perl, Python and Ruby). Although presented in "Cookbook" fashion, the order of the recipes is such that if you start at the beginning (recipes start in Chapter 2), the basics of regular expression syntax are presented in a logical, progressive manner, and thus, this book also functions as an effective tutorial.

However, I'm not personally a big fan of "Cookbook" style books in general, and prefer to learn a subject in depth in a systematic manner, and figure out the recipes later for myself. And in this regard, this "Cookbook" is not the best regex tutorial on the block (go to MRE3 for that). But if you don't have the time or inclination to learn regex in depth, and just need a solution to a specific problem right now, this book will serve up an accurate, efficient regex solution, no matter which tool or regex flavor you are using. And in one regard, the "Cookbook" beats MRE3 because it covers the Javascript flavor (which is not covered at all in MRE3). One other minor "Cookbook" deficiency is that it does not cover the new recursive expressions found in the latest versions of PHP/PCRE.

Note: If you are a Windows regex user, the Regexbuddy program is highly recommended - it has built-in libraries containing nearly all of the regexes provided in this "Cookbook" as well as built-in regex related code snippets for all of the programming languages as well. Its an excellent piece of software and an indispensible aid to the process of learning regular expressions. (It even has a built-in private forum where you can ask questions of the author directly!) And be sure to check out Jan's resource: [...] for free online regex tutorials and reference. Bottom line: Jan knows regular expressions and is very adept at explaining them!
6 of 7 people found the following review helpful
HASH(0xaaffc6e4) out of 5 stars Superb collection of Regular Expressions recipes is a great teacher July 6 2009
By Jerry Saperstein - Published on Amazon.com
Format: Paperback Verified Purchase
Jan Goyvaerts is well-known in the RegEx community; Steven Levithan somewhat less so. But the degree of fame is unimportant, both are Regular Expressions gurus and really know what they are talking about. Goyvaerts also writes and publishes some really cool software tools, including two for dealing with Regular Expressions.

The last great book on Regular Expressions was "Mastering Regular Expressions" by Jeffrey E. F. Friedl, also published by O'Reilly. This book does not replace "Mastering Regular Expressions", but complements it. Between the two volumes, you'll know everything of importance worth knowing about Regular Expressions and their use.

Regular Expressions are used to find specific patterns of text. For anyone working extensively with text of any kind, Regular Expressions are as necessary as water and air to sustaining human life. Most people never get behind the primitive search functions of their word processor or spreadsheet program. Too bad: they're missing a lot.

The ugly part of what they're missing is learning how to use Regular Expressions.

Conceptually, Regular Expressions are difficult for many people (like me) to grasp and even more difficult to learn. A big part of that is the staggering power of Regular Expressions ("regexp" or "regexes"). Want to a single search for specific words that are misspelled? Regex. How about sentences beginning or ending with specific words? Use a regex.

In their cookbook, the authors demonstrate more than a hundred examples. Better yet, they do it in seven common regex flavors. The authors claim "Regular Expressions Cookbook" is all you know to learn how to use Regular Expressions. They do start with the basics, but I question whether this book is all most will need. I think consulting one of the many fine Regular Expression tutorials on the web might be a helpful first step for the utter novice.

The cookbook itself is absolutely marvelous.

There are more than one hundred recipes, beginning with matching literal text; advancing through matching previously matched text again; retrieving a list of all matches; validating formats of things like email addresses, international phone numbers, even European VAT numbers; finding words not preceded or followed by a specific word; and much more.

This is, I short, a book for the true geek to curl up with and read. You may not need the information now, but you will need it someday and just browsing is an effective way to pick it up. Likewise, if you're looking for an immediate solution to a problem right now, just check the Table Of Contents. Odds are you'll find what you're looking for or something real close. Sadly, however, the index isn't very good.

In short, this is the newest benchmark reference for Regular Expressions. With this and "Mastering Regular Expressions", you are going to be a Master of the Universe and do things with text that will leave ordinary mortals awestruck.