| | |  | Software Engineering | Home » » » Regular Expressions Cookbook | | | | | | | Product Promotions: | | | | | Description: | | This O'Reilly Cookbook provides more than a hundred recipes to help programmers use regular expressions to manipulate text and crunch data. Every programmer needs a grasp of regular expressions, but their power doesn't come without problems--even seasoned users often have trouble tackling performance issues. With recipes for popular programming languages such as C#, Java, JavaScript, Perl, PHP, Python, Ruby, and VB.NET, this book offers step-by-step solutions to scores of common tasks involving regular expressions. This cookbook will help you: - Understand the basics of regular expressions through a concise tutorial
- Use regular expressions effectively in several programming and scripting languages
- Learn how to validate and format input
- Manage words, lines, special characters, and numerical values
- Find solutions for using regular expressions in URLs, paths, markup, and data exchange
- Learn the nuances of more advanced regex features
- Understand how regular expression APIs differ from language to language
- Write better regular expressions for custom needs
Whether you're a novice or an experienced user, Regular Expressions Cookbook will help deepen your understanding of this tool. You'll learn powerful new tricks, avoid language-specific gotchas, and save valuable time with this huge library of proven solutions to difficult, real-world problems. | | | Product Details: | | | Author:
| Jan Goyvaerts | | Paperback:
| 510 pages | | Publisher:
| O'Reilly Media | | Publication Date:
| May 29, 2009 | | Language:
| English | | ISBN:
| 0596520689 | | Product Length:
| 7.0 inches | | Product Width:
| 9.1 inches | | Product Height:
| 1.2 inches | | Product Weight:
| 1.8 pounds | | Package Length:
| 9.0 inches | | Package Width:
| 6.9 inches | | Package Height:
| 1.2 inches | | Package Weight:
| 1.8 pounds | | Average Customer Rating:
| based on 21 reviews |
| | | | Customer Reviews: | |
Average Customer Review:
( 21 customer reviews )
Write an online review and share your thoughts with other customers.
Most Helpful Customer Reviews
29 of 30 found the following review helpful:
At last a Use Case based RegEx BookJun 07, 2009
By Bob Reselman As much as I hate to admit it, regular expressions are hard for me. My need to use them is situation specific and I never really took the time to master them conceptually. So, when it comes time create one, I have to grope around to figure out how to meet the need at hand.
This book is really made for a person like me. The structure is problem-solution based. And, every problem is numbered in outline format. Thus, referencing back is an easy affair.
Want to know how to find bold text in an HTML file? This book will tell you how.
Want to learn how to split a sting using a regular expression? This book tells you how.
The book discusses solutions generally and in language specifics. It supports C#, Java, Javascript, Ruby, Python, PHP, Perl, VB.NET.... the entire cast of the usual characters. (No pun intended.)
The writing is clear. You can take things in a bit at a time. And, that some of the problems use those 'hard to get concepts', the topical discussions actually teach you the difficult concepts in a manner that is pretty easy to understand. Sometimes you might have to go over a section of few times to get full understanding. But the review is not a chore.
This is a good, useful book. It's helping me to become a better engineer. And believe me, I need all the help that I can get! :)
17 of 17 found the following review helpful:
VERY VERY HIGHLY RECOMMENDED!!Jun 11, 2009
By John R. Vacca
"Tech Write Independent Reviewer"
Do you regularly work with text on a computer? If you do, then this book is for you! Authors Jan Goyvaerts and Steven Levithan, have done an outstanding job of writing a book that shows you how you can use regular expressions in situations where people with limited regular expressions experience would normally say it can't be done.
Goyvaerts and Levithan, begin by explaining the role of regular expressions and introduce a number of tools that will make it easier to learn, create, and debug them. Next, the authors cover each element and feature of regular expressions, along with important guidelines for effective use. Then, they specify coding techniques and include code listings for using regular expressions in each of the programming languages covered by this book. They continue by focusing on recipes for handling typical user input, such as dates, phone numbers, and postal codes in various countries. Next, the authors explore common text processing tasks, such as checking for lines that contain or fail to contain certain words. Then, they show you how to detect integers, floating-point numbers, and several other formats for this kind of input. The authors continue by showing you how to take apart and manipulate the strings commonly used on the Internet and Windows systems to find things. Finally, the authors cover the manipulation of HTML, XML, comma-separated values (CSV), and INI-style configuration files.
This most excellent book shows you everything you need to know about regular expressions, and then some, regardless of whether you are a programmer. More importantly, if you read this book cover to cover, you'll become a world class chef of regular expressions.
16 of 17 found the following review helpful:
Goes further and deeper than many tutorials on regular expressionsJun 21, 2009
By Techie Evan This excellent book goes further and deeper than many tutorials on regular expressions. You might be surprised with some of the things you'll learn from reading it.
Unlike many cookbooks, this one doesn't dive into the recipes right away. I thought this was a good call because regular expressions are a specialized topic, and most developers don't work with regular expressions on a daily basis so they probably have to be reminded of the building block concepts and syntax, and get prepared for a discussion of more advanced features. Chapter One provides a list of recommended tools for working with regular expressions. Chapter 2 is a concise but very thorough discussion of building block and more advanced regular expression concepts (e.g., possessive quantifier or atomic grouping, named capturing groups, lookahead and lookbehind, etc.), including a discussion of differences in engine implementations and feature support. Chapter 3 is a hundred-plus page tutorial on how to work with regular expressions using different programming and scripting languages, including potential gotchas and workarounds. Chapters Four through Eight contain the recipes for solving real-world problems, with tips on how to improve an initial solution's readability (e.g., use named capturing groups when possible, etc.) and/or efficiency.
I was initially skeptical about the authors' ambitious goal of covering so many regular expression flavors, thinking the discussions of differences in engine supported features might prove distracting. The book is written and organized so well, however, my fear did not materialize. In fact, I was pleasantly surprised to learn that: of the covered flavors, Microsoft's DotNet regex engine supports some of the most advanced features.
There's not much to dislike about this book but if I were asked to suggest one or two things that might be of value-add to readers, I would suggest making available for download files containing appropriate subject strings for testing the book's various recipes as a convenience to readers who learn best by doing and want to follow along as they read the recipes, and for the book to include, for easy reference, a feature-support comparison matrix of the covered flavors, much like the comparison table available in the regular-expressions.info website.
11 of 12 found the following review helpful:
We Have Been Waiting for This OneJun 09, 2009
By Brett Merkey § I was getting set to write a review of this book, when I happened to visit one of the blogs I regularly read -- Coding Horror. Jeff Atwood says it all for me so please take a look at what he has to say.
If you are a serious programmer or even if you are a Web GUI design person forced to do a bit of JavaScripting like me, you are going to run into situations where using a regex engine is the appropriate tool. Regular expressions are not easy to learn and are kind of boring. They are also very powerful.
Most of us learn faster by doing -- and that most often means working from code we or someone else has done before that does something a bit like what we want to do but needs some tweaking or extending or generalizing. If you are like me, you already have a collection of regular expressions to help in this process. This book does better than that by collecting hundreds of examples together in ways that build your understanding while never getting abstract or divorced from the real problems we face.
Your shelf has a place for this book. Recommended. §
4 of 4 found the following review helpful:
Jan is a regex guru!Jun 26, 2009
By ridgerunner Preface: When I first dove into regular expressions two years ago, I jumped in head first with Jeffrey Friedl's classic: "Mastering Regular Expressions - 3rd Edition" (MRE3). I've read it twice so far and it is truly a masterpiece (very highly recommended). As I was learning to "think in regex", I needed some reliable tools with which to practice my newfound regex skills (I'm primarily a Windows guy). Although my text editor of choice at the time had three flavors of built-in regex support (UltraEdit32), its support for Perl compatible syntax had a few inconsistencies. A search for better regex tools led me to the EditPad Pro text editor and RegexBuddy, both from "Just Great Software" (JGSoft). These tools proved to be so well designed, bug-free and useful, that I decided to purchase the much more expensive PowerGrep (and was blown away with what I can do with that!) Armed with these tools and my newfound mastery of regular expressions (courtesy of MRE3), I now feel that I could conquer nearly any challenge from the world of text processing. I was very impressed with the quality, accuracy and attention to detail of all the JGSoft's software products, and when the author of these tools announced that he had a new book coming out on regular expressions, I pre-ordered it sight unseen. I knew it would be good. And it is. (Note that I am not affiliated in any way with JGSoft, I am just a very happy user of their software.)
Review: Jan Goyvaerts is one of the world's experts in the field of regular expressions. He is an "attention to details" and "we will serve no wine before its time" kind of guy, so I was not surprised to find "Regular Expressions Cookbook" well organized, accurate, easy to read, and having very few typos and/or grammatical errors. As far as I could tell (and I'm very nit picky), the recipe regexes presented are both accurate and efficient. Each recipe begins with a statement of the problem, the regex solutions, and then followed by an in-depth discussion/explaination of what is going on inside each regex component. And for each "recipe", multiple regexes are typically provided covering a spectrum of specificity (starting with general "easy-matches" moving to the more specific). And regexes are provided for each of the many supported flavors (i.e. .NET, Java, Javascript, PCRE, Perl, Python and Ruby), complete with the required regex modifiers/options. And where appropriate, footnotes are provided that further describe the peculiarities regarding a specific regex flavor. Attempting to cover all modern regex flavors in one book was a tall order, but this book does it well. In addition to the many regex flavors, Chapter 3 covers regex handling with many different programming languages (C#, VB.NET, Java, Javascript, PHP, Perl, Python and Ruby). Although presented in "Cookbook" fashion, the order of the recipes is such that if you start at the beginning (recipes start in Chapter 2), the basics of regular expression syntax are presented in a logical, progressive manner, and thus, this book also functions as an effective tutorial.
However, I'm not personally a big fan of "Cookbook" style books in general, and prefer to learn a subject in depth in a systematic manner, and figure out the recipes later for myself. And in this regard, this "Cookbook" is not the best regex tutorial on the block (go to MRE3 for that). But if you don't have the time or inclination to learn regex in depth, and just need a solution to a specific problem right now, this book will serve up an accurate, efficient regex solution, no matter which tool or regex flavor you are using. And in one regard, the "Cookbook" beats MRE3 because it covers the Javascript flavor (which is not covered at all in MRE3). One other minor "Cookbook" deficiency is that it does not cover the new recursive expressions found in the latest versions of PHP/PCRE.
Note: If you are a Windows regex user, the Regexbuddy program is highly recommended - it has built-in libraries containing nearly all of the regexes provided in this "Cookbook" as well as built-in regex related code snippets for all of the programming languages as well. Its an excellent piece of software and an indispensible aid to the process of learning regular expressions. (It even has a built-in private forum where you can ask questions of the author directly!) And be sure to check out Jan's resource: [...] for free online regex tutorials and reference. Bottom line: Jan knows regular expressions and is very adept at explaining them!
See all 21 customer reviews on Amazon.com
| | |
|