Mastering Regular Expressions, 2nd Edition
Publisher: O'Reilly Media
Release Date: July 2002
Pages: 496
Read on Safari with a 10-day trial
Start your free trial now Buy on AmazonWhere’s the cart? Now you can get everything on Safari. To purchase books, visit Amazon or your favorite retailer. Questions? See our FAQ or contact customer service:
1-800-889-8969 / 707-827-7019
support@oreilly.com
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 in Perl, 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. 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. In spite their wide availability, flexibility, and unparalleled power, regular expressions are frequently underutilized. 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. 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. 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. Mastering Regular Expressions, Second Edition has been thoroughly updated to include all the new features of Perl 5.8, as well as several other languages, including Java, VB.NET, C#, Python, JavaScript, Tcl, and Ruby. Written in the lucid, entertaining tone that made a complex, dry topic crystal-clear to thousands of programmers, and sprinkled with solutions to complex real-world problems, Mastering Regular Expressions offers a wealth information that you can put to immediate use. 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
Table of Contents
-
Chapter 1 Introduction to Regular Expressions
-
Solving Real Problems
-
Regular Expressions as a Language
-
The Regular-Expression Frame of Mind
-
Egrep Metacharacters
-
Expanding the Foundation
-
Personal Glimpses
-
Quiz Answer
-
-
Chapter 2 Extended Introductory Examples
-
About the Examples
-
Matching Text with Regular Expressions
-
Modifying Text with Regular Expressions
-
Quiz Answers
-
-
Chapter 3 Overview of Regular Expression Features and Flavors
-
A Casual Stroll Across the Regex Landscape
-
Care and Handling of Regular Expressions
-
Strings, Character Encodings, and Modes
-
Common Metacharacters and Features
-
Guide to the Advanced Chapters
-
-
Chapter 4 The Mechanics of Expression Processing
-
Start Your Engines!
-
Match Basics
-
Regex-Directed Versus Text-Directed
-
Backtracking
-
More About Greediness and Backtracking
-
NFA, DFA, and POSIX
-
Summary
-
Quiz Answers
-
-
Chapter 5 Practical Regex Techniques
-
Regex Balancing Act
-
A Few Short Examples
-
HTML-Related Examples
-
Extended Examples
-
-
Chapter 6 Crafting an Efficient Expression
-
A Sobering Example
-
A Global View of Backtracking
-
Benchmarking
-
Common Optimizations
-
Techniques for Faster Expressions
-
Unrolling the Loop
-
The Freeflowing Regex
-
In Summary: Think!
-
Quize Answers
-
-
Chapter 7 Perl
-
Regular Expressions as a Language Component
-
Perl's Regex Flavor
-
Regex-Related Perlisms
-
The qr/···/ Operator and Regex Objects
-
The Match Operator
-
The Substitution Operator
-
The Split Operator
-
Fun with Perl Enhancements
-
Perl Efficiency Issues
-
Final Comments
-
-
Chapter 8 Java
-
Judging a Regex Package
-
Object Models
-
Packages, Packages, Packages
-
Sun's Regex Package
-
A Quick Look at Jakarta-ORO
-
-
Chapter 9 .NET
-
.NET's Regex Flavor
-
Using .NET Regular Expressions
-
Core Object Details
-
Static "Convenience" Functions
-
Support Functions
-
Advanced .NET
-
-
About the Author
-
Colophon