Buy new:
$51.38$51.38
FREE delivery:
Sunday, Feb 12
Ships from: Amazon.com Sold by: Amazon.com
Buy Used: $25.00
Other Sellers on Amazon
& FREE Shipping
97% positive over last 12 months
& FREE Shipping
91% positive over last 12 months
Usually ships within 2 to 3 days.
& FREE Shipping
87% positive over last 12 months

Download the free Kindle app and start reading Kindle books instantly on your smartphone, tablet, or computer - no Kindle device required. Learn more
Read instantly on your browser with Kindle for Web.
Using your mobile phone camera - scan the code below and download the Kindle app.


Mastering Regular Expressions Third Edition
Price | New from | Used from |
- Kindle
$13.20 - $36.99 Read with Our Free App - Paperback
$25.00 - $51.38
Enhance your purchase
Regular expressions are an extremely powerful tool for manipulating text and data. They are now standard features in a wide range of languages and popular tools, including Perl, Python, Ruby, Java, VB.NET and C# (and any language using the .NET Framework), PHP, and MySQL.
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 regularexpressions, this book is a stunning eye-opener.
As this book shows, a command of regular expressions is an invaluable skill. 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. 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.
Yet despite their wide availability, flexibility, and unparalleled power, regular expressions are frequently underutilized. 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 and help you optimize your use of regular expressions.
Mastering Regular Expressions, Third Edition, now includes a full chapter devoted to PHP and its powerful and expressive suite of regular expression functions, in addition to enhanced PHP coverage in the central "core" chapters. Furthermore, this edition has been updated throughout to reflect advances in other languages, including expanded in-depth coverage of Sun's java.util.regex package, which has emerged as the standard Java regex implementation.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
Written in the lucid, entertaining tone that makes a complex, dry topic become crystal-clear to programmers, and sprinkled with solutions to complex real-world problems, Mastering Regular Expressions, Third Edition offers a wealth information that you can put to immediateuse.
Reviews of this new edition and the second edition:
"There isn't a better (or more useful) book available on regular expressions."
--Zak Greant, Managing Director, eZ Systems
"A real tour-de-force of a book which not only covers the mechanics of regexes in extraordinary detail but also talks about efficiency and the use of regexes in Perl, Java, and .NET...If you use regular expressions as part of your professional work (even if you already have a good book on whatever language you're programming in) I would strongly recommend this book to you."
--Dr. Chris Brown, Linux Format
"The author does an outstanding job leading the reader from regexnovice to master. The book is extremely easy to read and chock full ofuseful and relevant examples...Regular expressions are valuable toolsthat every developer should have in their toolbox. Mastering RegularExpressions is the definitive guide to the subject, and an outstandingresource that belongs on every programmer's bookshelf. Ten out of TenHorseshoes."
--Jason Menard, Java Ranch
- ISBN-100596528124
- ISBN-13978-0596528126
- EditionThird
- PublisherO'Reilly Media
- Publication dateAugust 18, 2006
- LanguageEnglish
- Dimensions7 x 1.3 x 9.19 inches
- Print length544 pages
Customers who viewed this item also viewed
From the brand

-
-
Sharing the knowledge of experts
O'Reilly's mission is to change the world by sharing the knowledge of innovators. For over 40 years, we've inspired companies and individuals to do new things (and do them better) by providing the skills and understanding that are necessary for success.
Our customers are hungry to build the innovations that propel the world forward. And we help them do just that.
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
- Publisher : O'Reilly Media; Third edition (August 18, 2006)
- Language : English
- Paperback : 544 pages
- ISBN-10 : 0596528124
- ISBN-13 : 978-0596528126
- Item Weight : 1.89 pounds
- Dimensions : 7 x 1.3 x 9.19 inches
- Best Sellers Rank: #120,883 in Books (See Top 100 in Books)
- #10 in Microsoft .NET
- #35 in JavaScript Programming (Books)
- #155 in Software Development (Books)
- Customer Reviews:
About the author

Discover more of the author’s books, see similar authors, read author blogs and more
Customer reviews
Customer Reviews, including Product Star Ratings help customers to learn more about the product and decide whether it is the right product for them.
To calculate the overall star rating and percentage breakdown by star, we don’t use a simple average. Instead, our system considers things like how recent a review is and if the reviewer bought the item on Amazon. It also analyzed reviews to verify trustworthiness.
Learn more how customers reviews work on Amazon
Reviewed in the United States on January 11, 2016
-
Top reviews
Top reviews from the United States
There was a problem filtering reviews right now. Please try again later.
This book is the definitive guide on regex. Full stop. I’m not quite halfway through and it has already increased my understanding of regex in ways I hadn’t imagined possible. That said, the 3rd edition is 16 years old and it shows. The author regularly references now out-of-date technologies (e.g., PHP and Tcl). But that in no way hampers his ability to teach and ingrain the material. One just simply needs to understand that due to its age, some claims may no longer be true.
For example, (and bare in mind I’m halfway through so I don’t know what I don’t yet know) there’s a chart stating that MySQL’s regex engine is a DFA. From what I’ve read, and knowing that MySQL “upgraded” their regex support in version 8, I believe it may now be an NFA. Or, at the very least, a hybrid. I could be wrong, but the point is, before reading this book, I wouldn’t have understood enough to even make that guess.
Now, will I skip the chapters that focus on PHP and Tcl? Perhaps the latter. It’s not like I can’t come back and read it later if I find myself ankle-deep in Tcl regex one day. I could say the same for PHP, but it’s in a lot of legacy software, so a quick read through it is probably worthwhile.
Not to keep bringing it up, but even halfway through, my understanding of lookarounds increased substantially. I use all of them regularly, but with a half-understanding of what was going on or why it would work sometimes and others not. Beyond that, greedy/lazy/possessive quantifiers… grouping. Sure, I’ve used them at some point. Some more often than others and with more understanding. But now? I get it all.
It’s kind of a shame. I don’t have to write regex every day and when I do, it’s usually file searching, so it’s throw-away code. However, I haven’t yet read the chapters on efficiency, so perhaps my knowledge will grow in that area and that will pay off daily!
Anyway, if you have any regular use of regex, this book is worth it. I picked up a used copy. I’d have paid cover price ($44.99 USD) easily knowing what’s actually in the book, how it’s written, etc. That brings me to my final point. The author does an amazing job of keeping what could be a very dry subject fresh and clear. You just can’t appreciate that enough.
This book gave me the level of understanding I was looking for. After reading this book I can confidently say that I'm 1000% more comfortable reading and creating my own regex. I stopped once I reached chapter 7 because the last chapters, 7-10 are language specific chapters, but in the future I'll definitely refer back to those chapters once I'm working with those languages.
Lastly, I did get some flak from other devs while I was reading this book "Geez you're reading a book on regex?? wow that's too boring for me." etc. etc. Don't listen to the haters! If you want a greater understanding of regex, and this book can get you there then don't listen to those nerds. At the end of the day and with learning anything, it only matters that the nerd in your shoes understands the subject. Also, take your time reading the book. It's perfectly fine to pace yourself and take more time reading, because there's a lot of needed detail.
The only minor issues I had was in the tools used to demonstrate the concepts. Although no tool used cost the reader money if they wish to hands-on follow along, some of the downloads are from third-party sites which have no guarantee of offering the download by the time you get the book. Additionally, the author makes heavy use of Perl to demonstrate RegEx in scripting, which is fine for Perl users, but those that use other languages to fend for themselves. Seeing additional examples in other free languages, such as VBScript or JScript would have been nice.
Overall, Mastering Regular Expressions is an excellent choice for both learning the basics as well as better preparing yourself to apply them in real-world situations. The writing style is easy to understand and follow, and the layout allows this book to be a learning resource now, and a decent general reference later.
Top reviews from other countries

So. The following applies to the *paperback* book.
In practice Freidl's book is primarily a programmer's reference. But like the best references (eg the C Programming Language) is formatted as a tutorial.
Introductory chapters establish a need for regexs, giving a brief history and presenting some straightforward use cases.
Thereafter Mr Freidl wades deeper into the waters of obscurity, and we are soon dealing with the minutiae of mode modifiers and greedy versus lazy quantifiers.
Some of this stuff goes rather deeper than I have ever needed to go. For example, opening the book at random to page 245, I read the subheadings 'Pre-check of required character/substring optimization' and 'Length-cognizance optimization'. Not of immediate use to me, but I am glad to know where I can find this if ever (heaven forfend) the performance of my application depends on the construction of regexs.
The last chapters of the book deal with the respective peculiarities and APIs of the regex implementations of Perl, Java, .NET and PHP. This last bit feels a little out of date - an updated edition would, I suppose, highlight JavaScript and other languages that have become important or gained regex implementations since the 2006 edition, eg C++ 11 and even Delphi. Meanwhile Perl's star has faded somewhat since the book was last revised; perhaps it should no longer be the 'default' language of example?
But this is nit-picking. I dare say it is possible to resolve any regex difficulty with a little applied Googling; but to have this book on your shelf is to know that you have an articulate, clear and complete explanation close to hand.

Would recommend this for any programmer who does not already know regular expressions or that needs to get a thorough understanding. As long as you use strings you will be able to draw some benefit.
As for me, I wonder how I ever managed without!


