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

FREE Shipping on orders over $35.

Used - Very Good | See details
Access codes and supplements are not guaranteed with used items.
Have one to sell? Sell yours here
Tell the Publisher!
I'd like to read this book on Kindle

Don't have a Kindle? Get your Kindle here, or download a FREE Kindle Reading App.

Mastering Regular Expressions, Second Edition [Paperback]

Jeffrey E.F. Friedl
4.7 out of 5 stars  See all reviews (38 customer reviews)

Available from these sellers.

Free Two-Day Shipping for College Students with Amazon Student


Amazon Price New from Used from
Tankobon Hardcover --  
Paperback --  
Shop the new
New! Introducing the, a hub for Software Developers and Architects, Networking Administrators, TPMs, and other technology professionals to find highly-rated and highly-relevant career resources. Shop books on programming and big data, or read this week's blog posts by authors and thought-leaders in the tech industry. > Shop now
There is a newer edition of this item:
Mastering Regular Expressions Mastering Regular Expressions 4.6 out of 5 stars (70)
In Stock.

Book Description

July 15, 2002 0596002890 978-0596002893 Second Edition

Regular expressions are an extremely powerful tool for manipulating text and data. They have spread like wildfire in recent years, now offered as standard features in Perl, Java, VB.NET and C# (and any language using the .NET Framework), PHP, Python, Ruby, Tcl, MySQL, awk, Emacs, and many other popular tools and languages. If you don't use regular expressions yet, you will discover in this book a whole new world of mastery over your data. If you already use them, you'll appreciate this book's unprecedented detail and breadth of coverage. If you think you know all you need to know about regular expressions, this book is a stunning eye-opener. In spite their wide availability, flexibility, and unparalleled power, regular expressions are frequently underutilized. Regular expressions allow you to code complex and subtle text processing that you never imagined could be automated. Regular expressions can save you time and aggravation. They can be used to craft elegant solutions to a wide range of problems. A command of regular expressions is an invaluable skill. Yet what is power in the hands of an expert can be fraught with peril for the unwary.

Mastering Regular Expressions will help you navigate the minefield to becoming an expert. Once you've mastered regular expressions, they'll become an invaluable part of your toolkit. You will wonder how you ever got by without them. Mastering Regular Expressions, Second Edition has been thoroughly updated to include all the new features of Perl 5.8, as well as several other languages, including Java, VB.NET, C#, Python, JavaScript, Tcl, and Ruby. Written in the lucid, entertaining tone that made a complex, dry topic crystal-clear to thousands of programmers, and sprinkled with solutions to complex real-world problems, Mastering Regular Expressions offers a wealth information that you can put to immediate use. Topics include:

  • A comparison of features among different versions of many languages and tools
  • How the regular expression engine works
  • Optimization (major savings available here!)
  • Matching just what you want, but not what you don't want
  • Sections and chapters on individual languages

Editorial Reviews

About the Author

Jeffrey Friedl was raised in the countryside of Rootstown, Ohio, and had aspirations of being an astronomer until one day he noticed a TRS-80 Model I sitting unused in the corner of the chem lab (bristling with a full 16K of RAM, no less). He eventually began using Unix (and regular expressions) in 1980, and earned degrees in Computer Science from Kent (BS) and the University of New Hampshire (MS). He did kernel development for Omron Corporation in Kyoto, Japan for eight years before moving in 1997 to Silicon Valley to apply his regular-expression know-how to financial news and data for a little-known company called "Yahoo!"

When faced with the daunting task of filling his copious free time, Jeffrey enjoys playing Ultimate Frisbee and basketball with friends at Yahoo!, programming his house, and feeding the squirrels and jays in his back yard. He also enjoys spending time with his wife Fumie, and preparing for the Fall 2002 release of their first "software project" together.

Product Details

  • Series: Nutshell Handbooks
  • Paperback: 496 pages
  • Publisher: O'Reilly Media; Second Edition edition (July 15, 2002)
  • Language: English
  • ISBN-10: 0596002890
  • ISBN-13: 978-0596002893
  • Product Dimensions: 8.9 x 7 x 1.3 inches
  • Shipping Weight: 1.7 pounds
  • Average Customer Review: 4.7 out of 5 stars  See all reviews (38 customer reviews)
  • Amazon Best Sellers Rank: #489,263 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
36 of 41 people found the following review helpful
5.0 out of 5 stars Simply Outstanding September 26, 2002
Format:Paperback|Verified Purchase
I bought this book on a whim, mainly because I try to buy (and read... ugh!) a hard-core technical book every month or so, but mainly because my UNIX scripting abilities have become rusty with disuse. I used to be able to write a tight, 10-line csh script to mangledit thousands of files at a single time. Now I hack away at files manually with vi. The other day, I even forgot how to search & replace. My kung fu isn't nearly what it used to be.
It usually takes me about a month to slog through a new book (especially academic texts, which are great but make you want to have a stiff martini before each new chapter) but I tore through Friedl's book in a few days. It's an outstanding reference for understanding & learning to use regular expressions.
Regexes can be cryptic to say the least, but Friedl offers many examples, broken down into step-by-step instructions and explanations of how each regex works (in many cases, right down to the individual character level). He covers a variety of platforms and languages - the hardcore Perl enthusiast will enjoy this book greatly, but he offers fairly equal time to alternative languages like Java and the "grep" family.
All that said, this book is an outstanding technical reference, pure and simple, for two reasons:
- Friedl uses an interesting new typesetting convention to illustrate which sections of text are regular expressions, and which sections are not. It's hard to describe (and impossible to reproduce here) but they look like 90-degree braces at the upper-left and lower-right corners. This is a FANTASTIC approach and I for one would love to see this extended to other technical books.
- Speaking of other things I would love to see extended to other technical books, THIS BOOK HAS ALMOST NO ERRORS!
Read more ›
Comment | 
Was this review helpful to you?
18 of 19 people found the following review helpful
5.0 out of 5 stars So good, I bought it twice! January 5, 2003
Format:Paperback|Verified Purchase
In spite of the vow that Friedl would not put himself (and his family) through the rigors of writing a followup to his first edition, I sure am glad he made the decision to write a second edition. Over 5 years ago, I got the first such book and found it to be a humbling experience -- realizing just how little I *really* knew about regular expressions (in spite of thinking my skills were quite advanced in that area).
Now, years later and as an instructor of UNIX at North Lake College in Irving, Texas, I highly recommend this book to even our first year students. Friedl's clear explanation of this topic and the manner in which he presents the material makes it comprehensible to even those that have never had experience with regex's before. Like Perl's Larry Wall, Jeffrey Friedl has a strong background in natural languages. That contributes not only to bhis lucid writing style but also helps in terms of understanding regex's as a "little language".
This 2nd edition is particularly welcome because of its extensive coverage of regular expressions in the context of Java. That ons aspect alone is sufficient to get the updated second edition (to say nothing of the enhancements in Perl since the first edition of the book).
Comment | 
Was this review helpful to you?
15 of 16 people found the following review helpful
5.0 out of 5 stars Separates the players from the punters August 12, 2002
Regular expressions help you "lex", or make sense of text input to your program in a method much more powerful than your junior college or MCSE program taught you.
In the mid '80's I wrote a lexer/parser/compiler as a class assignment. I definitely used regular expressions in order to break the input down into lexemes so I could generate object code. Back then, we learned regular expressions "the hard way".
This book makes learning them easier. You don't have to be writing a compiler in order to make use of regexes! Spam filtering is my current use for them.
2nd ed. vs. 1st ed.: He attacks the subject more seriously.
He (as far as I can tell) dropped "vi" coverage.
He uses Perl 5.8 for his examples, though has chapters for the most popular regex engines, including VB.NET.
Summary: I think it's easier to follow and more business-oriented than the 1st edition, though don't toss the 1st edition. You'll need them both.
Comment | 
Was this review helpful to you?
8 of 8 people found the following review helpful
4.0 out of 5 stars Comprehensive Guide to Regular Expressions May 28, 2003
Most computer programmers have heard of regular expressions, discussed in hushed tones and conjuring images of Unix gurus and their incomprehensible commands and godlike mastery of their systems, yet few actually know enough about regular expressions or how they work to do more than a simple word match using one, if that.
This book covers regular expressions from top to bottom in great and exhaustive detail, including the hows and whys of performance and supported features between the different engines that process them. Though geared mainly toward Perl, the examples and text will apply to nearly any system that provides support, from PHP to ASP to Python.
The text is fairly dense and is not exactly geared toward the novice programmer, though. I've had classes in Finite State Machines and still had to really apply my grey matter in a few spots to understand everything being discussed. However, the understanding the reader gains upon completion of the text is invaluable and will expand one's programming potential exponentially.
The one real lack of the book is a good overview and quick-reference card, but on the whole, the book is a good selection from the O'Reilly library and well worth the read of any serious programmer.
Comment | 
Was this review helpful to you?
Most Recent Customer Reviews
5.0 out of 5 stars Great Reference
I bought this as a reference guide because I don't use regex every day. It's very clear and explains very well what regex is and what it's capable of. Read more
Published 7 months ago by Chris
5.0 out of 5 stars Fantastic resource, don't go without it
This is must-have if you are trying to learn regexps or improve your knowledge of them. It carefully walks you through how to construct expressions, covering everything from the... Read more
Published on April 26, 2007 by T. Lewis
4.0 out of 5 stars Excellent beginner book
Very nice, good explanations.

Not exactly a plain old reference type book.
Published on January 3, 2007 by J. Goldstein
5.0 out of 5 stars Thorough Regex book
This book is an invaluable resource. I learned more than I wanted to know about regex after reading this book. Read more
Published on August 23, 2006 by Nate Klaiber
4.0 out of 5 stars Deep study of a deep subject
Regular Expressions are a powerful pattern matching process built into many programming languages (but often hidden and not fully exploited). Read more
Published on June 28, 2006 by GEORGE R. FISHER
3.0 out of 5 stars No summary or synopsis, only good for thorough detail.
Get the small pocket reference guide instead of this book! It is difficult to find what you want if you don't know exactly what you are looking for. Read more
Published on October 21, 2005 by Thomas
5.0 out of 5 stars The regex bible
The only book to explain regular expression in a clear and exhaustive manner, covering differences between the most important programming language in which regex are used. Read more
Published on October 10, 2005 by Giuseppe Costa
5.0 out of 5 stars Great Regex Book
I have known about regular expressions for a long time, but they have always been some kind of mysterious secret code. Read more
Published on September 28, 2005 by M. Kirsch
5.0 out of 5 stars The Bible Of Regular Expressions
Back in 2000 I had to complete some task and another engineer said "Use a Regular Expression". Ignorant of what a regular expression was, I got a quick explanation from the... Read more
Published on June 9, 2005 by Dan McKinnon
4.0 out of 5 stars A detailed view of the inner working of regular expressions
How come a technology that is as old as computers themselves is still around? Regular expressions solve one of the most basic problems in computer science: parsing strings. Read more
Published on June 4, 2005 by Christophe J. Fouquet
Search Customer Reviews
Search these reviews only

What Other Items Do Customers Buy After Viewing This Item?

Sell a Digital Version of This Book in the Kindle Store

If you are a publisher or author and hold the digital rights to a book, you can sell a digital version of it in our Kindle Store. Learn more


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