Regular Expressions Cookbook, 2nd Edition
Detailed Solutions in Eight Programming Languages
Publisher: O'Reilly Media
Final Release Date: August 2012
Pages: 612

Take the guesswork out of using regular expressions. With more than 140 practical recipes, this cookbook provides everything you need to solve a wide range of real-world problems. Novices will learn basic skills and tools, and programmers and experienced users will find a wealth of detail. Each recipe provides samples you can use right away.

This revised edition covers the regular expression flavors used by C#, Java, JavaScript, Perl, PHP, Python, Ruby, and VB.NET. You’ll learn powerful new tricks, avoid flavor-specific gotchas, and save valuable time with this huge library of practical solutions.

  • Learn regular expressions basics through a detailed tutorial
  • Use code listings to implement regular expressions with your language of choice
  • Understand how regular expressions differ from language to language
  • Handle common user input with recipes for validation and formatting
  • Find and manipulate words, special characters, and lines of text
  • Detect integers, floating-point numbers, and other numerical formats
  • Parse source code and process log files
  • Use regular expressions in URLs, paths, and IP addresses
  • Manipulate HTML, XML, and data exchange formats
  • Discover little-known regular expression tricks and techniques
Table of Contents
Product Details
About the Author
Recommended for You
Customer Reviews

REVIEW SNAPSHOT®

by PowerReviews
oreillyRegular Expressions Cookbook, 2nd Edition
 
4.2

(based on 17 reviews)

Ratings Distribution

  • 5 Stars

     

    (8)

  • 4 Stars

     

    (6)

  • 3 Stars

     

    (2)

  • 2 Stars

     

    (0)

  • 1 Stars

     

    (1)

94%

of respondents would recommend this to a friend.

Pros

  • Helpful examples (15)
  • Accurate (13)
  • Concise (10)
  • Well-written (10)
  • Easy to understand (7)

Cons

    Best Uses

    • Intermediate (15)
    • Expert (12)
    • Novice (6)
    • Student (3)
      • Reviewer Profile:
      • Developer (12)

    Reviewed by 17 customers

    Sort by

    Displaying reviews 1-10

    Back to top

    Previous | Next »

     
    4.0

    Usefull even without c++ for c++ user

    By teak

    from Jyväskylä, Finland

    About Me Designer, Developer, Educator

    Verified Reviewer

    Pros

    • Accurate
    • Easy to understand
    • Helpful examples
    • Well-written

    Cons

      Best Uses

      • Expert
      • Intermediate
      • Novice
      • Student

      Comments about oreilly Regular Expressions Cookbook, 2nd Edition:

      The subtitle of the book is "Detailed Solutions in Eight Programming Languages". Those eight languages are C#, Java, JavaScript, Perl, PHP, Python, Ruby, and VB.NET. This shows the major issue which I have with the book: no C++ even though C++11 standard brought built in regex support. The standard was approved on 2011 and book was released 2012, so it should have been incorporated, but there is only slight hint of it, Boost-, and PCRE-libraries in few paragraphs covering C and C++.

      Nevertheless the book is still very useful for C++ programmers as the recipes are about regular expressions and the languages are in a side role. (Though there are things which are easier with some languages and some things are harder with other languages, and the examples show this nicely.)

      I always find it praiseworthy to say that the description of the book on the O'Reilly page and the back cover text of the book are in harmony with the actual contents of the book. Remember to check the sampler here in order to see what is in the book and for the style of the text. The book covers multiple regex "dialects" and on every recipe it tells what works in which dialect if there are differences. The book also follows the standard O'Reilly notation and it is also easy to see if text in question is example or normal text. In pdf version the working links in text are nice addition as the book is 600+ pages and browsing it is a bit of work.

      Each recipe starts with problem description, next in line are the solutions in multiple languages and dialects (if needed), then comes discussion section explaining the solution and possible issues and finally see also section with links to other recipes with similarities to recipe in question. The book starts from basic regex skills so novices get full benefit of the book but it also covers rather complex regex tasks so I'd say that even seasoned regex users can benefit from the book, especially if they are forced to change regex dialect they have been using.

       
      5.0

      Not just a cookbook

      By jmxp

      from Durham, NC

      About Me Researcher

      Verified Reviewer

      Pros

      • Accurate
      • Concise
      • Helpful examples

      Cons

        Best Uses

        • Expert
        • Intermediate

        Comments about oreilly Regular Expressions Cookbook, 2nd Edition:

        Disclaimer: I received a free review copy of this work through the O'Reilly Blogger Review Program.

        Some people, when confronted with a problem, think, "I know, I'll use regular expressions." Now they have two problems.
        —Old Regex Proverb

        Among casual programmers, regular expressions maintain something like the status of the old Celtic ogham: forbidding to the uninitiated, yet redolent of secrets and deep magic. Like Perl, which helped popularize them, they are among the clearest examples of "write-only" code — devastatingly effective for those who concoct them, unparseable by everyone else.

        But it doesn't have to be this way. Goyvaerts and Levithan, the minds behind regular-expressions.info, have written a regular expressions cookbook that not only lays out clear recipes for the most common regular expressions tasks, but serves as a concise (and precise) introduction to the features of modern regex across eight different languages.

        That's right. If you are coding in C#, VB.NET, Java, Javascript, PHP, Perl, Python, Ruby, or a language that shares these dialects, explicit code is available to help you validate common inputs, parse URLs and Markup languages, and search text. As other reviewers have noted, however, if you are using POSIX regex, you will have to muddle through, since this variant is not covered.

        As someone who had written a handful of regular expressions with great difficulty, I got a lot of benefit from reading chapters 2 and 3, which cover basic regular expressions (a lot more than basic, in fact) and syntax for using regex in various programming languages. This alone is probably worth the price of admission. Some might prefer a gentler introduction, but no real background in regex theory is required (though some is helpful for understanding optimizations suggested in specific recipes), and the straight-ahead problem-solution format will likely be enough to get those with programming experience up to speed.

        Chapters 4 through 9 consist of recipes for various common regex tasks, complete with useful variants, illustrative examples, and workarounds for regex dialects lacking some useful modern features (we're looking at you, Javascript). As the authors note, this section is best used as reference or sipped occasionally, rather than read straight through.

        The authors do have products to flog, but some of them are free, and all of that is harmlessly relegated to the first chapter.

        I found the book tremendous both as a self-contained introduction and a cookbook, though those with very limited programming experience may opt for an introductory text first (the authors' own introduction at regular-expressions.info is pretty decent). In my experience, careful reading of the early chapters (2 and 3) got me a long way toward being able to "sight-read" the later recipes, which I consider a success. At the very least, I have a solid reference to grab next time I have a problem requiring regular expressions, one that I hope will prevent me from creating that second problem.

         
        5.0

        Regular Expressions Cookbook

        By Mat

        from Bentonville, AR

        About Me Sys Admin

        Verified Reviewer

        Pros

        • Accurate
        • Concise
        • Helpful examples
        • Well-written

        Cons

          Best Uses

          • Expert
          • Intermediate

          Comments about oreilly Regular Expressions Cookbook, 2nd Edition:

          've always been a fan of the 'Cookbook' series of books: it's the information I want, when I want it, without the fluff. This book definately does not disappoint. Here's how the book is laid out:

          1. Present the problem.
          2. Present the solution
          3. Present the solution if it's different in .net, java, pcre, etc.

          While the earlier chapters deal with the basics and some theory, this book is geared more to regex veterans. Regardless, it's a great addition to my 'essentials' shelf. Highly recommend to any professional who deals in regular expressions daily.

           
          5.0

          Concise

          By kubarium

          from Toronto, ON

          About Me Developer

          Verified Reviewer

          Pros

          • Accurate
          • Concise
          • Easy to understand
          • Helpful examples
          • Well-written

          Cons

            Best Uses

            • Expert
            • Intermediate
            • Novice

            Comments about oreilly Regular Expressions Cookbook, 2nd Edition:

            I found the book very detailed and helpful. Examples are interesting. I think it's one of the must have books when it comes to RegEx.

             
            4.0

            Multi Linquistic Regular Extraordinaire

            By Mike O'Sphere

            from Schaumburg, Il

            About Me Developer

            Pros

            • Accurate
            • Easy to understand
            • Helpful examples
            • Well-written

            Cons

              Best Uses

              • Expert
              • Intermediate
              • Novice
              • Student

              Comments about oreilly Regular Expressions Cookbook, 2nd Edition:

              Orginization serves reader on many levels. Comprehesive enough to be the primary source of regular expression solutions.

               
              5.0

              Great addition to my library.

              By Ian

              from Toronto, ON

              Verified Reviewer

              Pros

              • Accurate
              • Concise
              • Easy to understand
              • Helpful examples
              • Well-written

              Cons

                Best Uses

                • Expert
                • Intermediate

                Comments about oreilly Regular Expressions Cookbook, 2nd Edition:

                Once you have learned about the power of regular expressions, this is the book you want at hand to help you solve those daily problems that regular expressions work so well on.

                 
                4.0

                Engaging and easy to follow along.

                By freakwincy

                from Johannesburg, South Africa

                About Me Developer

                Verified Reviewer

                Pros

                • Easy to understand
                • Helpful examples
                • Well-written

                Cons

                  Best Uses

                  • Expert
                  • Intermediate
                  • Novice

                  Comments about oreilly Regular Expressions Cookbook, 2nd Edition:

                  I typically refer to it for solutions to specific problems which is how I generally like to read cookbooks rather than from cover to cover. I especially like how the different flavors of regexes are contrasted in the myriad of examples therein. There's something for everyone from relative newbies to aficionados.

                   
                  5.0

                  Regular Expressions is worth getting

                  By Eric Feldhusen

                  from Newberry, MI

                  About Me Developer, Sys Admin

                  Verified Reviewer

                  Pros

                  • Accurate
                  • Concise
                  • Easy to understand
                  • Helpful examples
                  • Well-written

                  Cons

                    Best Uses

                    • Intermediate
                    • Novice
                    • Student

                    Comments about oreilly Regular Expressions Cookbook, 2nd Edition:

                    The Regular Expressions Cookbook has been great for using with my job as a systems administrator. As I've made various little scripts to manipulate user data, I've used tips and tricks to speed up my writting process. And as I've been getting into a programming career, it's been great for showing me examples for me to speed up my coding skills.

                     
                    4.0

                    Fantastic programmer reference

                    By cdm

                    from Massachusetts, USA

                    Verified Reviewer

                    Pros

                    • Concise
                    • Helpful examples

                    Cons

                      Best Uses

                        Comments about oreilly Regular Expressions Cookbook, 2nd Edition:

                        As a seasoned programmer who must occasionally write regular expressions in a smattering of languages (e.g. Perl for build tools), I find this book very helpful, well organized, and a good reminder of the annoying differences in various flavors of regular expressions. Has saved me tons of time.

                         
                        5.0

                        For people who don't like REs

                        By Laurelboa

                        from Md

                        About Me Developer

                        Verified Reviewer

                        Pros

                        • Concise
                        • Easy to understand
                        • Helpful examples

                        Cons

                          Best Uses

                          • Intermediate

                          Comments about oreilly Regular Expressions Cookbook, 2nd Edition:

                          By that I mean I find regular expressions useful and powerful, but I don't find the puzzle aspect of them fun. This book has enough explanation so I know how some aspect works and examples to lead the way to m better understanding. When I am writing something that needs REs, this book is open on my screen.

                          Displaying reviews 1-10

                          Back to top

                          Previous | Next »

                           
                          Buy 2 Get 1 Free Free Shipping Guarantee
                          Buying Options
                          Immediate Access - Go Digital what's this?
                          Ebook: $41.99
                          Formats:  DAISY, ePub, Mobi, PDF
                          Print & Ebook: $54.99
                          Print: $49.99