Amazon.co.uk Review
The simple name hides an incredible amount of power when handling textual data with scripting languages such as Perl, Python and awk and more and the programmer that can master regular expressions can master just about anything.
From the off it's necessary to congratulate author Jeffrey Friedl on doing a superb job of asking what can be a very complex subject and breaking it down into digestible chunks that almost anyone can understand.
From the basics of character and pattern matching through to the recognition of complex string patterns and multiple character replacements to "greedy" metacharacters and how to curb their appetite, this is about as comprehensive as it gets.
With a handful of latter chapters devoted to the differences between scripting languages and the way in which they deal with regular expressions and so many examples it'll make your eyes water there's something here for everyone.
So, if you can examine a string like this "(\\.|[^"\\])*" and know what it does and how it does it there's plenty of reference material in here for those odd moments when you need a refresher. If, however, you've no idea what the above means, and you need the ability to handle textual data, buy this book. Now! --This text refers to an out of print or unavailable edition of this title.
Review
Leo LaPorte, TechTV, July 16, 2002
Netsurfer Digest, July 26, 2002
Leo LaPorte, TechTV, July 16, 2002
Book Description
Huw Collingbourne, PC Plus, March 2003
Jim Secan, The Journal of the Tucson Computer Society, Jan 2003
Jason Menard, javaranch.com, March 2003
Product Description
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
From the Publisher
From the Author
My book is all about using regular expressions to access and modify text and data. If you use Perl, Python, Emacs, awk, vi, Tcl, grep, etc., you'll find immediate benefit. If you have access to these or other programs that provide regular expression support, you'll probably benefit even more, as the book will open up a whole new world of power to you.
The book's home page is:
http://enterprise.ic.gc.ca/~jfriedl/regex/
You'll find the introduction, table of contents, and index online, among other things (the errata is also there, but as of yet there are no major boofoos found).
The response from readers so far has been extremely gratifying. If you get a chance to read it, I'd love to hear your thoughts! --This text refers to an out of print or unavailable edition of this title.
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.
Excerpted from Mastering Regular Expressions by Jeffrey E. F. Freidl. Copyright © 2002. Reprinted by permission. All rights reserved.
Java didnt come with a regex package until Java 1.4, so early programmers had to do without regular expressions. Over time, many programmers independently developed Java regex packages of varying degrees of quality, functionality, and complexity. With the early-2002 release of Java 1.4, Sun entered the fray with their java.util.regex package. In preparing this chapter, I looked at Suns package, and a few others (detailed starting on page 372). So which one is best? As youll soon see, there can be many ways to judge that.
In This Chapter Before e looking at whats in this chapter, its important to mention whats not in this chapter. In short, this chapter doesnt restate everything from Chapters 1 through 6. I understand that some readers interested only in Java may be inclined to start their reading with this chapter, and I want to encourage them not to miss the benefits of the preface and the earlier chapters: Chapters 1, 2, and 3 introduce basic concepts, features, and techniques involved with regular expressions, while Chapters 4, 5, and 6 offer important keys to regex understanding that directly apply to every Java regex package that I know of.
As for this chapter, it has several distinct parts. The first part, consisting of "Judging a Regex Package" and "Object Models," looks abstractly at some concepts that help you to understand an unfamiliar package more quickly, and to help judge its suitability for your needs. The second part, "Packages, Packages, Packages," moves away from the abstract to say a few words about the specific packages I looked at while researching this book. Finally, we get to the real fun, as the third part talks in specifics about two of the packages, Suns java.util.regex and Jakartas ORO package.
Judging a Regex Package
The first thing most people look at when judging a regex package is the regex flavor itself, but there are other technical issues as well. On top of that, "political" issues like source code availability and licensing can be important. The next sections give an overview of some points of comparison you might use when selecting a regex package.
Technical Issues
Some of the technical issues to consider are:
Engine Type? Is the underlying engine an NFA or DFA? If an NFA, is it a POSIX NFA or a Traditional NFA? (See Chapter 4 143)
Rich Flavor? How full-featured is the flavor? How many of the items on page 113 are supported? Are they supported well? Some things are more important than others: look around and lazy quantifiers, for example, are more important than possessive quantifiers and atomic grouping, because look-around and lazy quantifiers cant be mimicked with other constructs, whereas possessive quantifiers and atomic grouping can be mimicked with look ahead that allows capturing parentheses.
Unicode Support? How well is Unicode supported? Java strings support Unicode intrinsically, but does w "know which Unicode characters are "word" characters? What about d "and s "? Does b "understand Unicode? (Does its idea of a word character match w "s idea of a word character?) Are Unicode properties supported? How about blocks? Scripts? (....119) Which version of Unicodes mappings do they support: Version 3.0? Version 3.1? Version 3.2? Does case-insensitive matching work properly with the full breadth of Uni-code characters? For example, does a case-insensitive really match ...... ?
(Even in lookbehind?)
How Flexible? How flexible are the mechanics? Can the regex engine deal only with String objects, or the whole breadth of CharSequence objects? Is it easy to use in a multi-threaded environment?
How Convenient? The raw engine may be powerful, but are there extra "convenience functions" that make it easy to do the common things without a lot of cumbersome overhead? Does it, borrowing a quote from Perl, "make the easy things easy, and the hard things possible?"
JRE Requirements? What version of the JRE does it require? Does it need the latest version, which many may not be using yet, or can it run on even an old (and perhaps more common) JRE?
Efficient? How efficient is it? The length of Chapter 6 tells you how much there is to be said on this subject. How many of the optimisations described there does it do? Is it efficient with memory, or does it bloat over time? Do you have any control over resource utilization? Does it employ lazy evaluation to avoiding computing results that are never actually used?
Does it Work? When it comes down to it, does the package work? Are there a few major bugs that are "deal-breakers?" Are there many little bugs that would drive you crazy as you uncover them? Or is it a bulletproof, rock-solid package that you can rely on?
Of course, this list just the tip of the iceberg each of these bullet points could be expanded out to a full chapter on its own. Well touch on them when comparing packages later in this chapter. --This text refers to an out of print or unavailable edition of this title.