Buy new:
-37%
$37.92$37.92
FREE delivery Tuesday, March 17
Advertisement
Ships from: Amazon.com Sold by: Amazon.com
Save with Used - Good
$5.00$5.00
$3.99 delivery March 23 - 26
Advertisement
Ships from: HPB-Red Sold by: HPB-Red
Sorry, there was a problem.
There was an error retrieving your Wish Lists. Please try again.Sorry, there was a problem.
List unavailable.
Download the free Kindle app and start reading Kindle books instantly on your smartphone, tablet, or computer - no Kindle device required.
Read instantly on your browser with Kindle for Web.
Using your mobile phone camera - scan the code below and download the Kindle app.
Follow the author
OK
Mastering Regular Expressions 3rd Edition
Purchase options and add-ons
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.
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 immediate use.
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 regex novice to master. The book is extremely easy to read and chock full of useful and relevant examples...Regular expressions are valuable tools that every developer should have in their toolbox. Mastering Regular Expressions is the definitive guide to the subject, and an outstanding resource that belongs on every programmer's bookshelf. Ten out of Ten Horseshoes."
--Jason Menard, Java Ranch
- ISBN-100596528124
- ISBN-13978-0596528126
- Edition3rd
- PublisherO'Reilly Media
- Publication dateSeptember 12, 2006
- LanguageEnglish
- Dimensions7 x 1.3 x 9.19 inches
- Print length542 pages
Frequently bought together

Deals on related products
Customers also bought or read
- Regular Expressions Cookbook: Detailed Solutions in Eight Programming Languages
Paperback$29.99$29.99Delivery Tue, Mar 17 - Learning the bash Shell: Unix Shell Programming (In a Nutshell (O'Reilly))#1 Best SellerUnix Programming
Paperback$24.23$24.23Delivery Tue, Mar 17 - Regular Expression Pocket Reference: Regular Expressions for Perl, Ruby, PHP, Python, C, Java and .NET (Pocket Reference (O'Reilly))
Paperback$12.60$12.60Delivery Tue, Mar 17 - Introducing Regular Expressions: Unraveling Regular Expressions, Step-by-Step
Paperback$28.46$28.46Delivery Mar 26 - Apr 6 - grep Pocket Reference: A Quick Pocket Reference for a Utility Every Unix User Needs (Pocket Reference (O'Reilly))
Paperback$14.73$14.73Delivery Tue, Mar 17 - The AWK Programming Language (Addison-Wesley Professional Computing Series)
Paperback$37.41$37.41FREE delivery Tue, Mar 17 - Fluent Python: Clear, Concise, and Effective Programming
Paperback$43.99$43.99FREE delivery Tue, Mar 17 - JavaScript: The Definitive Guide: Master the World's Most-Used Programming Language
Paperback$53.35$53.35FREE delivery Tue, Mar 17 - Python Pocket Reference: Python In Your Pocket (Pocket Reference (O'Reilly))
Paperback$13.79$13.79Delivery Tue, Mar 17 - Managing Projects with GNU Make: The Power of GNU Make for Building Anything (Nutshell Handbooks)
Paperback$24.42$24.42Delivery Mar 18 - 20 - Mathematics of Machine Learning: Master linear algebra, calculus, and probability for machine learning
Paperback$50.99$50.99FREE delivery Tue, Mar 17 - The Unix Programming Environment (Prentice-Hall Software Series)
Paperback$90.30$90.30FREE delivery Mar 27 - 31 - Learning the vi and Vim Editors: Power and Agility Beyond Just Text Editing
Paperback$43.49$43.49FREE delivery Tue, Mar 17 - Practical SQL, 2nd Edition: A Beginner's Guide to Storytelling with Data#1 Best SellerSQL
Paperback$21.49$21.49Delivery Tue, Mar 17 - Build a Large Language Model (From Scratch)#1 Best SellerComputer Neural Networks
Paperback$49.24$49.24FREE delivery Tue, Mar 17 - Learning Perl: Making Easy Things Easy and Hard Things Possible
Paperback$44.99$44.99FREE delivery Tue, Mar 17 - Python for Data Analysis: Data Wrangling with pandas, NumPy, and Jupyter
Paperback$43.99$43.99FREE delivery Tue, Mar 17 - SQL for Data Analysis: Advanced Techniques for Transforming Data into Insights
Paperback$36.49$36.49FREE delivery Tue, Mar 17
From the brand
-
Your partner in learning
-
Bestsellers
-
Software Development
-
Programming Languages
-
AI / Machine Learning
-
Data Science
-
Data, Databases and more
-
Cloud Services
-
Business
-
Finance
-
Blockchain / Cryptocurrency
-
Security
-
Lean series
-
Cookbooks
-
Head First series
-
97 Things series
-
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
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
- Publication date : September 12, 2006
- Edition : 3rd
- Language : English
- Print length : 542 pages
- ISBN-10 : 0596528124
- ISBN-13 : 978-0596528126
- Item Weight : 2.31 pounds
- Dimensions : 7 x 1.3 x 9.19 inches
- Best Sellers Rank: #719,196 in Books (See Top 100 in Books)
- #12 in XML Programming (Books)
- #104 in JavaScript Programming (Books)
- #756 in Software Development (Books)
- Customer Reviews:
About the author

Discover more of the author’s books, see similar authors, read book recommendations and more.
Related products with free delivery on eligible orders
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 AmazonReviews with images
expressions not displaying properly on kindle
Top reviews from the United States
There was a problem filtering reviews. Please reload the page.
- Reviewed in the United States on November 20, 2022Format: PaperbackVerified PurchaseMost regex books, blogs, websites, tutorials and classes cover “just the basics” really. Even the ones that say “advanced” often barely get into lookarounds.
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.
- Reviewed in the United States on January 2, 2012Format: PaperbackVerified PurchaseThis book is the best regular expression book out there. I've been writing software for several years and my practical experience didn't scratch the surface of what regular expressions can do and how they work.
If you want to decipher complex regular expressions and write your own, this is THE book to read. Friedl never glosses over important points and he never makes assumptions that you already understand regular expressions. The fact is, most of us just don't. Although regular expressions is mostly a pretty dry topic, Friedl does a good job lightening things up here and there (enough to prevent the topic from being too dry, but not so much that we forget the serious nature of the subject matter).
The typographic conventions are nothing short of groundbreaking, and I believe there is no other volume out there, on the web, or written that does as good of a job walking you through regular expressions, explaining how all the various parts work together and how to do things in your own practical way.
This book teaches you to THINK in regular expressions. Those once cryptic symbols will become powerful tools for you to manipulate and get the results you need. For me, regular expressions were a bit of stumbling block and a possible security risk (since I couldn't decipher really complex regular expressions). Aside from that, I didn't know the difference between NFA, DFA, and Posix NVA or how to optimize regex for these various engines (or whether optimization is even needed).
I strongly recommend this book for both beginners and veterans of regular expressions. It might not change your life, but it will change the way you read and write regular expressions.
- Reviewed in the United States on September 26, 2011Format: PaperbackVerified PurchaseThis is one of the best books a person could imagine on a highly technical theme. The author keeps a wonderful balance of theory, practice, and those pesky details that really make all the difference when one sits down to complete a project.
By not asserting himself as a mathematical authority, Friedl lets his cleverness come through in a practical, 'human-to-human' way. There are a few moments when the more theoretically minded reader might want a little more detail, but the balance Friedl keeps is beyond admirable.
In the entire book there are perhaps only a half-dozen pages that are 'challenging' to the mind, yet by the time the reader has finished the book he or she will be amazed, simply amazed, at the complexity of regular expressions that can be interpretted with ease. Of course, writing expressions takes more practice, but the regex muscles won't even notice the feather-light daily tasks of, say, basic data validation after working out on this text.
The book will start the reader looking for possible regex solutions everywhere, and provides enough detail to take the fear out of using them.
Top reviews from other countries
-
Cliente AmazonReviewed in Spain on July 30, 20195.0 out of 5 stars Libro básico ...
Format: PaperbackVerified Purchase... para cualquier lenguaje de programación
-
物知り小学生Reviewed in Japan on April 22, 20145.0 out of 5 stars 正規表現のバイブル
Format: PaperbackVerified Purchase日本語版の半額程度で購入できました。
英語の勉強にもなっていいかもしれません。
とは言うものの、まだ最初の方しか読めていませんが。
-
Leonardo SorensenReviewed in Brazil on February 18, 20185.0 out of 5 stars Livro excelente
Format: KindleVerified PurchaseEnsina com maestria coisas que eu não sabia que não sabia. Não se limita a ensinar expressões regulares para o uso cotidiano; mostra também como as expressões são processadas e compara explicando a diferença de performance de diferentes patterns.
Mr. Ian LinwoodReviewed in the United Kingdom on June 4, 20255.0 out of 5 stars Excellent reference
Format: PaperbackVerified PurchaseExcellent reference.
ValtersReviewed in Germany on August 14, 20255.0 out of 5 stars Still the best harcopy regex guide
Format: PaperbackVerified PurchaseYes, this book is from the mid-2000s. No, it’s not outdated. Mastering Regular Expressions is still the clearest, most in-depth way to learn regex—regardless you’re coding in Perl, Java, PHP, or building your own data-parsing. All - in - all, Regex feels like learning a new language: confusing at first, but over time, its secrets unfold and the patterns start to click.
This isn’t a quick-tip book—it’s a deep dive. If you’re serious about getting results (and not just reading the story), this will give you the skills to bend data to your will. Timeless, practical, and surprisingly addictive.






















