Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


This cookbook provides more than 100 recipes to help you crunch data and manipulate text with regular expressions. Every programmer can find uses for regular expressions, but their power doesn't come worry-free. Even seasoned users often suffer from poor performance, false positives, false negatives, or perplexing bugs. Regular Expressions Cookbook offers step-by-step instructions for some of the most common tasks involving this tool, with recipes for C#, Java, JavaScript, Perl, PHP, Python, Ruby, and VB.NET. With this book, you will:

  • Understand the basics of regular expressions through a concise tutorial

  • Use regular expressions effectively in several programming and scripting languages

  • Learn how to validate and format input

  • Manage words, lines, special characters, and numerical values

  • Find solutions for using regular expressions in URLs, paths, markup, and data exchange

  • Learn the nuances of more advanced regex features

  • Understand how regular expressions' APIs, syntax, and behavior differ from language to language

  • Write better regular expressions for custom needs

Whether you're a novice or an experienced user, Regular Expressions Cookbook will help deepen your knowledge of this unique and irreplaceable tool. You'll learn powerful new tricks, avoid language-specific gotchas, and save valuable time with this huge library of proven solutions to difficult, real-world problems.

Subscriber Reviews

Average Rating: 4.25 out of 5 rating Based on 4 Ratings

"Very good book to learn Regex" - by Marcio R on 13-FEB-2014
Reviewer Rating: 1 star rating2 star rating3 star rating4 star rating5 star rating
I had a problem to solve that could use Regex, I never had used before so I decided to study it. I only used this book and it was great, Chapter 2 has lots of examples for the functions you need to implement. I regularly came back to see something I need.
Report as Inappropriate

"Regular Expressions Cookbook" - by Shanti on 03-SEP-2010
Reviewer Rating: 1 star rating2 star rating3 star rating4 star rating5 star rating
I love this book.I liked the way they gave various recipes in chapter 2.This made me compare learning regular expressions is equivalent to cooking.You get better as you try on more recipes.

Thankyou authors for such a lovely book

Report as Inappropriate

Table of Contents



The publisher has provided additional content related to this title.


Visit the catalog page for Regular Expressions Cookbook

  • Catalog Page

Visit the errata page for Regular Expressions Cookbook

  • Errata