Shop Canis
Enjoy fast, free delivery, exclusive deals, and award-winning movies & TV shows.
Buy New
-55% $26.95
FREE delivery Tuesday, October 6 on orders shipped by Amazon over $35
Ships from: Amazon
Sold by: NEVER STOP WORKING
$26.95 with 55 percent savings
List Price: $59.99 Image
Get Fast, Free Shipping with Amazon Prime
FREE delivery Tuesday, October 6 on orders shipped by Amazon over $35
Or Prime members get FREE delivery Tomorrow, October 2. Order within 5 hrs 6 mins. Join Prime
Only 1 left in stock - order soon.
$$26.95 () Includes selected options. Includes initial monthly payment and selected options. Details
Price
Subtotal
$$26.95
Subtotal
Initial payment breakdown
Shipping cost, delivery date, and order total (including tax) shown at checkout.
Ships from
Amazon
Amazon
Ships from
Amazon
Returns
FREE 30-day refund/replacement
FREE 30-day refund/replacement
Quick refund
Usually issued within 24 hours. See exceptions
FREE return
At least one free return option available.
Convenient dropoff
At any of our 50,000 US locations.
See return policy
Gift options
Available at checkout
Available at checkout This item is a gift. Change
At checkout, you can add a custom message, a gift receipt for easy returns and have the item gift-wrapped
Payment
Secure transaction
Your transaction is secure
We work hard to protect your security and privacy. Our payment security system encrypts your information during transmission. We don’t share your credit card details with third-party sellers, and we don’t sell your information to others. Learn more
$7.59
Fast Free Shipping – Very Good condition book with a firm cover and clean pages. Shows normal use and some light wear or limited notes markings. A solid, nice copy to enjoy. Fast Free Shipping – Very Good condition book with a firm cover and clean pages. Shows normal use and some light wear or limited notes markings. A solid, nice copy to enjoy. See less
FREE delivery October 7 - 9. Details
Only 1 left in stock - order soon.
$$26.95 () Includes selected options. Includes initial monthly payment and selected options. Details
Price
Subtotal
$$26.95
Subtotal
Initial payment breakdown
Shipping cost, delivery date, and order total (including tax) shown at checkout.
Access codes and supplements are not guaranteed with used items.
Ships from and sold by GREENWORLD BOOKS.
Added to

Sorry, there was a problem.

There was an error retrieving your Wish Lists. Please try again.

Sorry, there was a problem.

List unavailable.
Kindle app logo image

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.

QR code to download the Kindle App

  • Mastering Regular Expressions

Follow the author

Follow authors for new release and deal updates, plus improved recommendations. See updates from all followed authors in Your Books.
Something went wrong. Please try your request again later.

Mastering Regular Expressions

4.6 out of 5 stars (350)

{"desktop_buybox_group_1":[{"displayPrice":"$26.95","priceAmount":26.95,"currencySymbol":"$","integerValue":"26","decimalSeparator":".","fractionalValue":"95","symbolPosition":"left","hasSpace":false,"showFractionalPartIfEmpty":true,"offerListingId":"ojGpZ4bgXI%2BmOGemKyMi6cGbJhrZ6n1b6szELO2erezkl79K83%2F6IOssDwKdM5yS5nbKWUPt8Iq0vbSR5IHixUNHLt8YKct9%2BW1D70hA0h7Ghqdo%2FEWeiDxfHy1jPuTRXGKUChF9Wq8CCghCkVlKDE%2FevtWMl2%2FbfLvcjiqpAOEfMCOGkrHRDWAhG3hKOBi2","locale":"en-US","buyingOptionType":"NEW","aapiBuyingOptionIndex":0}, {"displayPrice":"$7.59","priceAmount":7.59,"currencySymbol":"$","integerValue":"7","decimalSeparator":".","fractionalValue":"59","symbolPosition":"left","hasSpace":false,"showFractionalPartIfEmpty":true,"offerListingId":"ojGpZ4bgXI%2BmOGemKyMi6cGbJhrZ6n1b0amCJoqW5q%2BGUV%2B2WoSuY1aYG2iMgG6xyyYymx%2FrgF3jPFGlpl6cJBRR12JhVxTETNaqVJvx%2BKg26MDH%2FsQYkm2iOfvJD6PlhxaPf3O23GnloECEJ0nC7q5OpuA%2Fkjvr1loY3HW0fXzFOlAsAp%2BVXjAr%2BcnRufo3","locale":"en-US","buyingOptionType":"USED","aapiBuyingOptionIndex":1}]}

Purchase options and add-ons

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 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

Frequently bought together

This item: Mastering Regular Expressions
$26.47
Get it as soon as Tuesday, Oct 13
Ships from and sold by Amazon.com.
+
$17.20
Get it as soon as Tuesday, Oct 6
Only 5 left in stock (more on the way).
Ships from and sold by Amazon.com.
+
$26.67
Get it as soon as Tuesday, Oct 6
Only 3 left in stock (more on the way).
Ships from and sold by Amazon.com.
Total price: $00
To see our price, add these items to your cart.
Details
Added to Cart
Some of these items ship sooner than the others.
Choose items to buy together.

Customers also bought or read

Loading...

From the brand

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
  • 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: #363,309 in Books (See Top 100 in Books)
  • Customer Reviews:
    4.6 out of 5 stars (350)

About the author

Follow authors for new release and deal updates, plus improved recommendations. See updates from all followed authors in Your Books.
Jeffrey E F Friedl
Brief content visible, double tap to read full content.
Full content visible, double tap to read brief content.

Discover more of the author’s books, see similar authors, read book recommendations and more.

Customer reviews

4.6 out of 5 stars
350 global ratings
expressions not displaying properly on kindle
1 out of 5 stars
expressions not displaying properly on kindle
so far on the kindle reader on my ipad, desktop and iphone some of the expressions do not display correctly. something about the formatting does not display right and i have to copy paste into a notepad in order to see it correctly. this is highly annoying. i have not tried my kindle paperwhite.
Thank you for your feedback
Sorry, there was an error
Sorry we couldn't load the review

Top reviews from the United States

  • 5 out of 5 stars
    The best Regex book out there.
    Reviewed in the United States on January 2, 2012
    Brief content visible, double tap to read full content.
    Full content visible, double tap to read brief content.

    This 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.

    7 people found this helpful
    Sending feedback...
    Thank you for your feedback.
    Sending feedback...
    Thanks, we'll investigate in the next few days.

    We'll check if this review meets our community guidelinesOpens in a new tab. If it doesn't, we'll remove it.

  • 5 out of 5 stars
    The Regex Manual
    Reviewed in the United States on November 20, 2022
    Brief content visible, double tap to read full content.
    Full content visible, double tap to read brief content.

    Most 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.

    7 people found this helpful
    Sending feedback...
    Thank you for your feedback.
    Sending feedback...
    Thanks, we'll investigate in the next few days.

    We'll check if this review meets our community guidelinesOpens in a new tab. If it doesn't, we'll remove it.

  • 4 out of 5 stars
    Best Title on the Subject
    Reviewed in the United States on August 28, 2006
    Brief content visible, double tap to read full content.
    Full content visible, double tap to read brief content.

    If you have ever been frustrated trying to figure out Regular Expressions (RegEx) based only on a table showing symbols and a few paragraphs of explanations obviously written by someone who assumes you are already familiar with the concept, then this book is for you. Don't be daunted by 480+ page size of this title; before you reach the end of chapter 2 you find yourself with a solid understanding of the concepts, structure, syntax and "keywords" in common use by those utilities, programming languages and applications that incorporate RegExs. The middle of the book covers implementation of RegEx in different environments, techniques for creating the expressions, and methods for creating efficient expressions. The end chapters are specific for Perl, Java, VB.NET and PHP users.

    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.

    9 people found this helpful
    Sending feedback...
    Thank you for your feedback.
    Sending feedback...
    Thanks, we'll investigate in the next few days.

    We'll check if this review meets our community guidelinesOpens in a new tab. If it doesn't, we'll remove it.

  • 5 out of 5 stars
    I wanted to really learn regex - Good read.
    Reviewed in the United States on February 13, 2019
    Brief content visible, double tap to read full content.
    Full content visible, double tap to read brief content.

    I use to google "regex" and refer to the websites that would show from the search results. In my opinion, most of these sites were hard to use when trying to really understand regex. Maybe I wasn't persistent enough to screen crawl through several regex webpages/websites. I knew in my very soul I didn't understand regex well, because of constant issues coming up with seemingly easy regular expressions. I finally decided I wanted something comprehensive to learn regex.

    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.

    30 people found this helpful
    Sending feedback...
    Thank you for your feedback.
    Sending feedback...
    Thanks, we'll investigate in the next few days.

    We'll check if this review meets our community guidelinesOpens in a new tab. If it doesn't, we'll remove it.

  • 5 out of 5 stars
    Very Useful!!!
    Reviewed in the United States on June 1, 2026
    Brief content visible, double tap to read full content.
    Full content visible, double tap to read brief content.

    I'm working on the PCAP, but I know a little about programming languages, and somewhere I picked up noun phrases and verb phrases.

    Sending feedback...
    Thank you for your feedback.
    Sending feedback...
    Thanks, we'll investigate in the next few days.

    We'll check if this review meets our community guidelinesOpens in a new tab. If it doesn't, we'll remove it.

  • 5 out of 5 stars
    Read it Slow Take you time
    Reviewed in the United States on July 20, 2022
    Brief content visible, double tap to read full content.
    Full content visible, double tap to read brief content.

    If you want to have a deeper understand of regular expressions then this is a good book for you. If you just want a regular expression cookbook then this book is definitely not for you. It's written in a story form and it builds upon itself so unless you are willing to read it linearly then you would be wasting your time. It talks a lot about how different regular expression engines work and this is helpful to understand how to build regular expression.

    5 people found this helpful
    Sending feedback...
    Thank you for your feedback.
    Sending feedback...
    Thanks, we'll investigate in the next few days.

    We'll check if this review meets our community guidelinesOpens in a new tab. If it doesn't, we'll remove it.

  • 5 out of 5 stars
    A classic, if not THE regex classic
    Reviewed in the United States on September 26, 2011
    Brief content visible, double tap to read full content.
    Full content visible, double tap to read brief content.

    This 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.

    9 people found this helpful
    Sending feedback...
    Thank you for your feedback.
    Sending feedback...
    Thanks, we'll investigate in the next few days.

    We'll check if this review meets our community guidelinesOpens in a new tab. If it doesn't, we'll remove it.

  • 5 out of 5 stars
    Awesome book, horrible fonts
    Reviewed in the United States on September 3, 2017
    Brief content visible, double tap to read full content.
    Full content visible, double tap to read brief content.

    Lots of good information, well organized, well presented.

    My only complaint is the fonts. Both the text of the book and the source code. The font used for the regular text is very light, I would have preferred a larger, darker, and more bold font. The font used for the source code is absolutely horrible. There are little angle brackets used to identify a block (for example to highlight what has changed from the prior example). They are almost impossible to see. This is important because the author is constantly referring to the highlighted portions. Some pages are darker print than others, its inconsistent.

    If another edition of this book is ever made, I would like to see larger more bold font, and use a completely different method to "highlight" portions of text in the code samples.

    I wonder if this font issues occur in the Kindle edition...?

    17 people found this helpful
    Sending feedback...
    Thank you for your feedback.
    Sending feedback...
    Thanks, we'll investigate in the next few days.

    We'll check if this review meets our community guidelinesOpens in a new tab. If it doesn't, we'll remove it.

Top reviews from other countries

    Translated by Amazon
    See original
  • 5 out of 5 stars
    Libro básico ...
    Reviewed in Spain on July 30, 2019
    Brief content visible, double tap to read full content.
    Full content visible, double tap to read brief content.

    ... para cualquier lenguaje de programación

    Sending feedback...
    Thanks, we'll investigate in the next few days.

    We'll check if this review meets our community guidelinesOpens in a new tab. If it doesn't, we'll remove it.

    Translated from Spanish by Amazon
    See original
  • 5 out of 5 stars
    正規表現のバイブル
    Reviewed in Japan on April 22, 2014
    Brief content visible, double tap to read full content.
    Full content visible, double tap to read brief content.

    日本語版の半額程度で購入できました。

    英語の勉強にもなっていいかもしれません。

    とは言うものの、まだ最初の方しか読めていませんが。

    Sending feedback...
    Thanks, we'll investigate in the next few days.

    We'll check if this review meets our community guidelinesOpens in a new tab. If it doesn't, we'll remove it.

    Translated from Japanese by Amazon
    See original
  • 5 out of 5 stars
    Everything you need to know about Regular Expressions
    Reviewed in the United Kingdom on July 1, 2026
    Brief content visible, double tap to read full content.
    Full content visible, double tap to read brief content.

    Very thorough, great reference, hard to just read from cover to cover but will get there eventually. Great price for second hand very good condition.

    Sending feedback...
    Thanks, we'll investigate in the next few days.

    We'll check if this review meets our community guidelinesOpens in a new tab. If it doesn't, we'll remove it.

  • 5 out of 5 stars
    Livro excelente
    Reviewed in Brazil on February 18, 2018
    Brief content visible, double tap to read full content.
    Full content visible, double tap to read brief content.

    Ensina 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.

    Sending feedback...
    Thanks, we'll investigate in the next few days.

    We'll check if this review meets our community guidelinesOpens in a new tab. If it doesn't, we'll remove it.

    Translated from Portuguese by Amazon
    See original
  • 5 out of 5 stars
    Still the best harcopy regex guide
    Reviewed in Germany on August 14, 2025
    Brief content visible, double tap to read full content.
    Full content visible, double tap to read brief content.

    Yes, 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.

    Sending feedback...
    Thanks, we'll investigate in the next few days.

    We'll check if this review meets our community guidelinesOpens in a new tab. If it doesn't, we'll remove it.