Have one to sell? Sell yours here
Sorry, this item is not available in
Image not available for
Colour:
Image not available

 
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.

Regular Expression Recipes: A Problem-Solution Approach [Paperback]

Nathan A. Good


Available from these sellers.


Amazon.co.uk Trade-In Store
Did you know you can trade in your old books for an Amazon.co.uk Gift Card to spend on the things you want? Visit the Books Trade-In Store for more details. Learn more.

Book Description

1 Dec 2004

Regular expressions are an essential part of programming, but they sure are hard to come to grips with, aren’t they? Fortunately, we have the answer for you! Regular Expression Recipes provides you with all the open-source regular expressions you’ll ever need, and explains how to use each one. This way, you can learn by example, rather than muddling through countless pages of explanatory syntax.

Author Nathan A. Good includes syntax references only when necessary. Languages covered include Perl, PHP, grep, vim, Python, and shell. Web and applications developers, and system administrators will find the examples both accurate and relevant. And this book acts as a useful reference to keep handy for those moments when an answer is needed fast.

Table of Contents

  1. Words and Text
  2. URLs and Paths
  3. CSV and Tab-Delimited Files
  4. Formatting and Validating
  5. HTML and XML
  6. Coding and Using Commands


Product details


More About the Author

Discover books, learn about writers, and more.

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

Customer Reviews

There are no customer reviews yet on Amazon.co.uk.
5 star
4 star
3 star
2 star
1 star
Most Helpful Customer Reviews on Amazon.com (beta)
Amazon.com: 4.0 out of 5 stars  7 reviews
21 of 21 people found the following review helpful
4.0 out of 5 stars Grab bag of commonly used regular expressions 29 Dec 2004
By Jack D. Herrington - Published on Amazon.com
Format:Paperback
This is the cookbook approach to regular expressions. Nathan gives a bunch of common scenarios (parsing filenames, CSV, validating emails and SSNs) and gives us the expression in Perl. Followed by a discussion of the code, and further examples in PHP, shell script, VIM and others.

There is a small section at the beginning to teach you the fundamentals. But there is nothing at the level of Mastering Regular Expressions (O'Reilly), the classic work in the field.

This book is a good reference for those more interested in simply getting the job done, than in understanding how or why the pattern works. There are some bad examples. In particular the Spam filter example is almost worthless. But most of the examples are well written.
12 of 12 people found the following review helpful
4.0 out of 5 stars A cookbook of useful regular expressions for Perl and more. 18 Mar 2005
By R. Lodato - Published on Amazon.com
Format:Paperback
If you spend time working writing applications that have to do pattern matches and/or replacements, you know about some of the intricacies of regular expressions. For many people they can be an arcane hodgepodge of odd characters, but they don't have enough time (or interest) to really understand how to code them. Nathan A. Good has written <cite>Regular Expression Recipes: A Problem-Solution Approach</cite> for those people. In its relatively slim 289 pages, he offers 100 regular expressions in a cookbook format, tailored to solve problems in one of six broad categories (Words and Text, URLs and Paths, CSV and Tab-Delimited Files, Formatting and Validating, HTML and XML, and Coding and Using Commands).

Regular expressions are not restricted to just the Perl or shell environments, so Nathan offers variations for Python, PHP, and VIM as well. In most cases the translation is relatively straight-forward, but in a few cases a different environment may have (or lack) additional facilities, prompting a different expression to do the same task.

Before you even read chapter 1, Nathan provides a quick summary course on regular expressions, with detail given to each of the five environments you might utilize. He has written the syntax overview in a highly-readable format, making it easy to understand the gobbledy-gook of the most bizarre concoctions you might encounter.

In each chapter, Nathan gives examples of how to find single words, multiple words, and repeated words, along with examples of how to replace various detected strings with others. In each case he gives an example of its use for each platform, followed by a bit-by-bit breakdown of how it works. Not every environment is given on every example, and in many cases the "How It Works" section refers to the first one, as most REs are identical between the platforms.

First, I must admit that there are a number of useful solutions provided, especially for someone who is concerned with application and web development. However, I did feel a little cheated by the fact that several chapters covered essentially the same task, with only minor variations. It almost seemed as though the author was trying to pad out the solution count to the magic number 100. A simple example: three solutions in chapter one cover (a) replacing smart quotes with straight quotes, (b) replacing copyright symbols with the (c) tri-graph, and (c) replacing trademark symbols with the (tm) sequence. Did we really need three separate chapters for that? I don't think so.

Another quibble revolves around some of the coding of the expressions. Nathan has made liberal use of the non-capturing groups to insure only the items that needed replacement were captured. While a worthy idea, in some cases the expression may have been simplified for understanding. Another issue is a slight error in searching for letters. In a number of expressions, Nathan uses [A-z] to capture all letters. Unfortunately, the special characters [, \, ], ^, _, and ` occur between upper-case Z and lower-case a, making it match too much. Either [[:alpha:]] or [A-Za-z] should have been used.

Despite a couple of quibbles, <cite>Regular Expression Recipes</cite> does provide a useful compendium of solutions for common problems developers face. Presenting the information in a cookbook fashion, along with insuring that those using something other than Perl don't have to sweat translating the expressions to their target language, makes this a handy book to have. I wouldn't hesitate to recommend it.
12 of 12 people found the following review helpful
4.0 out of 5 stars Regular Expressions for the Beginner 2 Jan 2005
By Robert L. Stinnett - Published on Amazon.com
Format:Paperback
In "Regular Expression Recipes" the author does a good job of cutting away the sometimes tedious and at sometimes overwhelming job of teaching the reader every in and out of regular expessions and instead focuses on providing practical, real-world examples that the reader can try in a variety of languages and see instant results.

No doubt, one of the strengths of this book is that is takes Regular Expressions and demonstrates them not in just one language but in several (Perl, Python, PHP, grep, sed and Vim). In this way, a reader who is familiar with any of these languages can catch on and understand what is happening without having to learn yet another syntax just to understand the basics of regular expressions.

The book itself is categorized into different topics with an index system that makes it easy to jump to right what you are most interested in. When the author covers a topic, such as Reformatting Last Names, he also cross-references other useful, related regular expressions that the reader may also have an interest in given the topic.

Of particular interest to those new to the Regular Expression field, the author does a good job of explaining in everyday terms how an expression works. One of the drawbacks of many RegEx books is that often you cannot grasp exactly why a certain syntax works because of the complexity of the problem.

The only lacking spot in this book is that it does not include any "real" output of running the regular expressions; however given the content and ease-of-use of the book, this is but a small caveat that should not impact most readers.

Overall, a wonderful reference that explains Regular Expressions in terms that most beginning and intermediate users will enjoy and learn from.
Were these reviews helpful?   Let us know

Customer Discussions

This product's forum
Discussion Replies Latest Post
No discussions yet

Ask questions, Share opinions, Gain insight
Start a new discussion
Topic:
First post:
Prompts for sign-in
 

Search Customer Discussions
Search all Amazon discussions
   


Listmania!


Look for similar items by category


Feedback