Synopses & Reviews
Regular expressions are an extremely powerful tool for manipulating text and data.They have spread like wildfire in recent years, now offered as standard features inPerl, Java, VB.NET and C# (and any language using the .NET Framework), PHP, Python,Ruby, Tcl, MySQL, awk, Emacs, and many other popular tools and languages. Ifyou don't use regular expressions yet, you will discover in this book a whole newworld of mastery over your data. If you already use them, you'll appreciate thisbook's unprecedented detail and breadth of coverage. If you think you know all youneed to know about regular expressions, this book is a stunning eye-opener. In spitetheir wide availability, flexibility, and unparalleled power, regular expressions arefrequently underutilized. Regular expressions allow you to code complex and subtletext processing that you never imagined could be automated. Regular expressions cansave you time and aggravation. They can be used to craft elegant solutions to a widerange of problems. A command of regular expressions is an invaluable skill. Yet whatis power in the hands of an expert can be fraught with peril for the unwary.
- A comparison of features among different versions of many languagesand 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
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, Java, VB.NET and C# (and any language using the .NET Framework), PHP, Python, Ruby, Tcl, MySQL, awk, and Emacs. 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. A command of regular expressions is an invaluable skill. 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.
A tutorial and reference to using the technique of regular expressions to facilitate the handling of text and data in Perl and other scripting languages, editors such as Emacs and programming environments including Delphi and Visual C++, and specialized tools such as and Expect. This workbook assumes the reader has experience on a computer but no programming knowledge.
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.
Table of Contents
Copyright; Dedication; Preface; The Need for This Book; Intended Audience; How to Read This Book; Organization; Typographical Conventions; Exercises; Links, Code, Errata, and Contacts; Personal Comments and Acknowledgments; Chapter 1: Introduction to Regular Expressions; 1.1 Solving Real Problems; 1.2 Regular Expressions as a Language; 1.3 The Regular-Expression Frame of Mind; 1.4 Egrep Metacharacters; 1.5 Expanding the Foundation; 1.6 Personal Glimpses; 1.7 Quiz Answer; Chapter 2: Extended Introductory Examples; 2.1 About the Examples; 2.2 Matching Text with Regular Expressions; 2.3 Modifying Text with Regular Expressions; 2.4 Quiz Answers; Chapter 3: Overview of Regular Expression Features and Flavors; 3.1 A Casual Stroll Across the Regex Landscape; 3.2 Care and Handling of Regular Expressions; 3.3 Strings, Character Encodings, and Modes; 3.4 Common Metacharacters and Features; 3.5 Guide to the Advanced Chapters; Chapter 4: The Mechanics of Expression Processing; 4.1 Start Your Engines!; 4.2 Match Basics; 4.3 Regex-Directed Versus Text-Directed; 4.4 Backtracking; 4.5 More About Greediness and Backtracking; 4.6 NFA, DFA, and POSIX; 4.7 Summary; 4.8 Quiz Answers; Chapter 5: Practical Regex Techniques; 5.1 Regex Balancing Act; 5.2 A Few Short Examples; 5.3 HTML-Related Examples; 5.4 Extended Examples; Chapter 6: Crafting an Efficient Expression; 6.1 A Sobering Example; 6.2 A Global View of Backtracking; 6.3 Benchmarking; 6.4 Common Optimizations; 6.5 Techniques for Faster Expressions; 6.6 Unrolling the Loop; 6.7 The Freeflowing Regex; 6.8 In Summary: Think!; 6.9 Quize Answers; Chapter 7: Perl; 7.1 Regular Expressions as a Language Component; 7.2 Perl's Regex Flavor; 7.3 Regex-Related Perlisms; 7.4 The qr/···/ Operator and Regex Objects; 7.5 The Match Operator; 7.6 The Substitution Operator; 7.7 The Split Operator; 7.8 Fun with Perl Enhancements; 7.9 Perl Efficiency Issues; 7.10 Final Comments; Chapter 8: Java; 8.1 Judging a Regex Package; 8.2 Object Models; 8.3 Packages, Packages, Packages; 8.4 Sun's Regex Package; 8.5 A Quick Look at Jakarta-ORO; Chapter 9: .NET; 9.1 .NET's Regex Flavor; 9.2 Using .NET Regular Expressions; 9.3 Core Object Details; 9.4 Static "Convenience" Functions; 9.5 Support Functions; 9.6 Advanced .NET; About the Author; Colophon;