Programming Books C Java PHP Python Learn more Browse Programming Books

Sorry, this item is not available in
Image not available for
Image not available

To view this video download Flash Player


Sign in to turn on 1-Click ordering
Sell Us Your Item
For a $12.06 Gift Card
Trade in
Kindle Edition
Read instantly on your iPad, PC, Mac, Android tablet or Kindle Fire
Buy Price: $22.99
Rent From: $11.13
More Buying Choices
Have one to sell? Sell yours here

Regular Expressions Cookbook [Paperback]

by Jan Goyvaerts, Steven Levithan
4.7 out of 5 stars  See all reviews (23 customer reviews)

List Price: $49.99
Price: $32.98 & FREE Shipping on orders over $35. Details
You Save: $17.01 (34%)
o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o
In Stock.
Ships from and sold by Gift-wrap available.
Want it tomorrow, April 25? Choose One-Day Shipping at checkout. Details
Free Two-Day Shipping for College Students with Amazon Student


Amazon Price New from Used from
Kindle Edition
Rent from
Paperback $32.98  
Sell Us Your Books
Get up to 80% back when you sell us your books, even if you didn't buy them at Amazon. Learn more

Book Description

September 3, 2012 1449319432 978-1449319434 Second Edition

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.

This revised edition covers the regular expression flavors used by C#, Java, JavaScript, Perl, PHP, Python, Ruby, and VB.NET. You’ll learn powerful new tricks, avoid flavor-specific gotchas, and save valuable time with this huge library of practical solutions.

  • Learn regular expressions basics through a detailed tutorial
  • Use code listings to implement regular expressions with your language of choice
  • Understand how regular expressions differ from language to language
  • Handle common user input with recipes for validation and formatting
  • Find and manipulate words, special characters, and lines of text
  • Detect integers, floating-point numbers, and other numerical formats
  • Parse source code and process log files
  • Use regular expressions in URLs, paths, and IP addresses
  • Manipulate HTML, XML, and data exchange formats
  • Discover little-known regular expression tricks and techniques

Frequently Bought Together

Regular Expressions Cookbook + Mastering Regular Expressions + Introducing Regular Expressions
Price for all three: $84.89

Buy the selected items together

Customers Who Bought This Item Also Bought

Editorial Reviews

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.

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.

Product Details

  • Paperback: 612 pages
  • Publisher: O'Reilly Media; Second Edition edition (September 3, 2012)
  • Language: English
  • ISBN-10: 1449319432
  • ISBN-13: 978-1449319434
  • Product Dimensions: 9.2 x 7.1 x 1.3 inches
  • Shipping Weight: 2.1 pounds (View shipping rates and policies)
  • Average Customer Review: 4.7 out of 5 stars  See all reviews (23 customer reviews)
  • Amazon Best Sellers Rank: #131,994 in Books (See Top 100 in Books)

More About the Author

Discover books, learn about writers, read author blogs, and more.

Customer Reviews

Most Helpful Customer Reviews
10 of 10 people found the following review helpful
Although I run the risk of fawning all over this book here, Jan Goyvaerts and Steven Levithan's "Regular Expressions Cookbook (Second Edition)" (O'Reilly, 2012) is a technical text that I will gladly describe using words like "essential" and "indispensable" and "invaluable". It should be on every working programmer's bookshelf, if not on her desk. It is exhaustive and rigorous, covering the major regex flavors across eight popular/widespread general purpose languages. [1] If your work brings you in regular contact with regular expressions, then you need easy access to this book.

To begin with, Goyvaerts and Levithan present an in-depth discussion of each regex feature, starting with the very basics (e.g., making matches against literal expressions) and working up into some pretty sophisticated topics (e.g., writing parsers). True to the title, their approach is a "cookbook" style: a general problem is stated, a solution is presented (or multiple solutions, if that's what it takes), and then they go into an almost painful (but neatly sectioned) level of detail about the solution, describing it token-for-token in some cases. Now, by "neatly sectioned" I mean that their discussion of each solution is broken down by language [2] wherein they are careful to point out flavor- and/or language-specific nuances, quirks, bugs, and/or unique features. They are very careful about this part--if a particular feature does not work in a language (e.g., how JavaScript lacks named capturing groups) then they show you how to work around that deficiency; but perhaps more importantly, if a feature is unique to a language, they point it out as such and caution you against using them (i.e., to keep your regexes general and portable). [3]

Later chapters (i.e.
Read more ›
Comment | 
Was this review helpful to you?
9 of 10 people found the following review helpful
4.0 out of 5 stars Good Tools September 1, 2012
O'Reilly cookbooks are awesome. But just like I don't read the recipes cover-to-cover in regular cookbooks, I don't read all the recipes in the O'Reilly cookbooks either. Also just like regular cookbooks, the day before Thanksgiving is not a good time to open the cookbook for the first time, I at least glance thru all the recipes to know what is there, pick out a few that I can use right away, and dog ear the ones I think I will come back to. So here are the criteria that I review this book with:

1. Easy Navigation: Yep, this book is easy to navigate. If I need to do, say form validation, I know I should start at Chapter 4 "Validation and Formatting".
2. Clear and precise explanation: Yes, I think the explanation are short and precise to the topic of discussion.
3. Pointer for more information: This is hard to do, but the book has a section on "See Also" for correlation between recipes and a general pointer toward 'Master Regular Expression' in the introduction chapter.
4. Easy Reading: Hum.. here is more of a wish list of mine, I wish the book is broken down into different books by language. The book covers these languages, VB.NET, C#, Java, JavaScript, XRegExp, PHP, Perl, Python, and Ruby. I typically skip down to Python and occasionally stop at C# and PHP. The book is over 600 pages and listed at $49.99. I would have been happy to pay 1/5 of the price to get one that just focus on Python, and another 1/5 of the price to get one on PHP.

All in all, it is a good value and a keeper on the bookshelf. But I really think it should be broken down into language-specific cookbook as most reader probably use only one or two languages on a daily basis. With today's print-on-demand, e-book format, I think it would be very minimal work for the author and a whole lot of less skipping for the readers. Just my 2 cents.
Comment | 
Was this review helpful to you?
6 of 6 people found the following review helpful
5.0 out of 5 stars The ultimate regular expressions cheat sheet September 18, 2012
The authors say it best when they say that the book is intended for those who:

"regularly work with text on a computer, whether that's searching through a pile of documents, manipulating text in a text editor, or developing software that needs to search through or manipulate text."

The first three chapters of this book cover useful tools, basic regular expression skills, and programming with regular expressions. Chapters 4 through 9 contain the practical regular expressions recipes. The programming languages that are covered in this book are C#, Java, JavaScript, PHP, Perl, Python, Ruby, and VB.NET. Every recipe that is in the book has solutions and explanations for all eight languages.

The recipes are organized and easy to look up. For example, finding regular expressions that deal with validation, words, lines, URLs, and etc can be easily located in the table of contents. The author's tone is straightforward, direct, and informative. This is not the kind of book where you read from start to finish, but rather a book where you just skim through to find the recipe that you need in whatever given situation.

With all the languages that the book covers, there are just too many languages to put into a single book. I feel as though instead of having a book with all the languages, it would be better to have a book with a single language. However, I must give praise on how well the authors were able to consolidate detailed solutions in 8 programming languages.

For everything that the book is and everything that it covers, the book offers a lot of information at a bargain. If you work with regular expressions and need a reference book, this book is definitely the way to go.
Comment | 
Was this review helpful to you?
Most Recent Customer Reviews
5.0 out of 5 stars Lexical Recipes
It starts with a good analysis of online and offline regexp tools. Most known applications that can be found in the net, but doing a emphasis to his proprietary tool... Read more
Published 3 months ago by German Gonzalez
5.0 out of 5 stars Excellent tips for use of Regular Expressions.
I first bought Jan Goyvaerts' Regex book from his site after trying to learn some regex to modify around 700 web pages I was moving from a Windows server to a Linux server. Read more
Published 4 months ago by Santos Jaimes
5.0 out of 5 stars I like this book
This is a very good book. I tought me a lot. The examples are very useful and the book does a good job of breaking them down.
Published 6 months ago by Larry Carlin
4.0 out of 5 stars Definitely a reference manual, not a tutorial
Unlike some O'Reilly cookbooks that are really language or product tutorials organized under clever "recipe" headings, this book was definitely written to be a reference book. Read more
Published 12 months ago by Joshua Davies
5.0 out of 5 stars What I needed...and more!
This book is exactly what the name says: a cookbook of regular expressions. At over 570 pages, this book is jam-packed with regular expression recipes for all sorts of situations... Read more
Published 12 months ago by Jamie Wilson
5.0 out of 5 stars Great Explanation and Reference for Regex
Regular expressions was definitely an area in which I was lacking. While I still wouldn't consider myself an expert, this book has really taken me a long way in understanding how I... Read more
Published 14 months ago by A. Garcia
5.0 out of 5 stars a Regular Expression "experience toolkit" in a book
As a software developer for over 20 years, I find the Regex Cookbook truly indispensable and I now have hardcopy and e-book versions of this book. Read more
Published 15 months ago by S. Hebert
5.0 out of 5 stars Excellent, covers even more than expected
I got this for my husband, who is a 'senior software engineer'. He was delighted, and he is extraordinarily picky. Read more
Published 15 months ago by Caraleisa
4.0 out of 5 stars One of Few Programming Books in My Collection that I Consider...
Software developers and programmers alike, Goyvaerts and Levithan present the second edition of Regular Expressions Cookbook having worked extensively with regular expressions and... Read more
Published 15 months ago by Systems Dude
4.0 out of 5 stars An Excellent Starting Point
I do a lot of work with shell scripts in a Linux environment so I do need to use regular expressions on a fairly frequent basis. Read more
Published 16 months ago by Matthew K. Morgan
Search Customer Reviews
Only search this product's reviews

What Other Items Do Customers Buy After Viewing This Item?


There are no discussions about this product yet.
Be the first to discuss this product with the community.
Start a new discussion
First post:
Prompts for sign-in

Look for Similar Items by Category