| Preface | p. xv |
| Introduction to Regular Expressions | p. 1 |
| Solving Real Problems | p. 2 |
| Regular Expressions as a Language | p. 4 |
| The Filename Analogy | p. 4 |
| The Language Analogy | p. 5 |
| The Regular-Expression Frame of Mind | p. 6 |
| If You Have Some Regular-Expression Experience | p. 6 |
| Searching Text Files: Egrep | p. 6 |
| Egrep Metacharacters | p. 8 |
| Start and End of the Line | p. 8 |
| Character Classes | p. 9 |
| Matching Any Character with Dot | p. 11 |
| Alternation | p. 13 |
| Ignoring Differences in Capitalization | p. 14 |
| Word Boundaries | p. 15 |
| In a Nutshell | p. 16 |
| Optional Items | p. 17 |
| Other Quantifiers: Repetition | p. 18 |
| Parentheses and Backreferences | p. 20 |
| The Great Escape | p. 22 |
| Expanding the Foundation | p. 23 |
| Linguistic Diversification | p. 23 |
| The Goal of a Regular Expression | p. 23 |
| A Few More Examples | p. 23 |
| Regular Expression Nomenclature | p. 27 |
| Improving on the Status Quo | p. 30 |
| Summary | p. 32 |
| Personal Glimpses | p. 33 |
| Extended Introductory Examples | p. 35 |
| About the Examples | p. 36 |
| A Short Introduction to Perl | p. 37 |
| Matching Text with Regular Expressions | p. 38 |
| Toward a More Real-World Example | p. 40 |
| Side Effects of a Successful Match | p. 40 |
| Intertwined Regular Expressions | p. 43 |
| Intermission | p. 49 |
| Modifying Text with Regular Expressions | p. 50 |
| Example: Form Letter | p. 50 |
| Example: Prettifying a Stock Price | p. 51 |
| Automated Editing | p. 53 |
| A Small Mail Utility | p. 53 |
| Adding Commas to a Number with Lookaround | p. 59 |
| Text-to-HTML Conversion | p. 67 |
| That Doubled-Word Thing | p. 77 |
| Overview of Regular Expression Features and Flavors | p. 83 |
| A Casual Stroll Across the Regex Landscape | p. 85 |
| The Origins of Regular Expressions | p. 85 |
| At a Glance | p. 91 |
| Care and Handling of Regular Expressions | p. 93 |
| Integrated Handling | p. 94 |
| Procedural and Object-Oriented Handling | p. 95 |
| A Search-and-Replace Example | p. 97 |
| Search and Replace in Other Languages | p. 99 |
| Care and Handling: Summary | p. 101 |
| Strings, Character Encodings, and Modes | p. 101 |
| Strings as Regular Expressions | p. 101 |
| Character-Encoding Issues | p. 105 |
| Regex Modes and Match Modes | p. 109 |
| Common Metacharacters and Features | p. 112 |
| Character Representations | p. 114 |
| Character Classes and Class-Like Constructs | p. 117 |
| Anchors and Other "Zero-Width Assertions" | p. 127 |
| Comments and Mode Modifiers | p. 133 |
| Grouping, Capturing, Conditionals, and Control | p. 135 |
| Guide to the Advanced Chapters | p. 141 |
| The Mechanics of Expression Processing | p. 143 |
| Start Your Engines! | p. 143 |
| Two Kinds of Engines | p. 144 |
| New Standards | p. 144 |
| Regex Engine Types | p. 145 |
| From the Department of Redundancy Department | p. 146 |
| Testing the Engine Type | p. 146 |
| Match Basics | p. 147 |
| About the Examples | p. 147 |
| The Match That Begins Earliest Wins | p. 148 |
| Engine Pieces and Parts | p. 149 |
| The Standard Quantifiers Are Greedy | p. 151 |
| Regex-Directed Versus Text-Directed | p. 153 |
| NFA Engine: Regex-Directed | p. 153 |
| DFA Engine: Text-Directed | p. 155 |
| First Thoughts: NFA and DFA in Comparison | p. 156 |
| Backtracking | p. 157 |
| A Really Crummy Analogy | p. 158 |
| Two Important Points on Backtracking | p. 159 |
| Saved States | p. 159 |
| Backtracking and Greediness | p. 162 |
| More About Greediness and Backtracking | p. 163 |
| Problems of Greediness | p. 164 |
| Multi-Character "Quotes" | p. 165 |
| Using Lazy Quantifiers | p. 166 |
| Greediness and Laziness Always Favor a Match | p. 167 |
| The Essence of Greediness, Laziness, and Backtracking | p. 168 |
| Possessive Quantifiers and Atomic Grouping | p. 169 |
| Possessive Quantifiers, ?+, *+, ++, and {m,n}+ | p. 172 |
| The Backtracking of Lookaround | p. 173 |
| Is Alternation Greedy? | p. 174 |
| Taking Advantage of Ordered Alternation | p. 175 |
| NFA, DFA, and POSIX | p. 177 |
| "The Longest-Leftmost" | p. 177 |
| POSIX and the Longest-Leftmost Rule | p. 178 |
| Speed and Efficiency | p. 179 |
| Summary: NFA and DFA in Comparison | p. 180 |
| Summary | p. 183 |
| Practical Regex Techniques | p. 185 |
| Regex Balancing Act | p. 186 |
| A Few Short Examples | p. 186 |
| Continuing with Continuation Lines | p. 186 |
| Matching an IP Address | p. 187 |
| Working with Filenames | p. 190 |
| Matching Balanced Sets of Parentheses | p. 193 |
| Watching Out for Unwanted Matches | p. 194 |
| Matching Delimited Text | p. 196 |
| Knowing Your Data and Making Assumptions | p. 198 |
| Stripping Leading and Trailing Whitespace | p. 199 |
| HTML-Related Examples | p. 200 |
| Matching an HTML Tag | p. 200 |
| Matching an HTML Link | p. 201 |
| Examining an HTTP URL | p. 203 |
| Validating a Hostname | p. 203 |
| Plucking Out a URL in the Real World | p. 205 |
| Extended Examples | p. 208 |
| Keeping in Sync with Your Data | p. 208 |
| Parsing CSV Files | p. 212 |
| Crafting an Efficient Expression | p. 221 |
| A Sobering Example | p. 222 |
| A Simple Change--Placing Your Best Foot Forward | p. 223 |
| Efficiency Verses Correctness | p. 223 |
| Advancing Further--Localizing the Greediness | p. 225 |
| Reality Check | p. 226 |
| A Global View of Backtracking | p. 228 |
| More Work for a POSIX NFA | p. 229 |
| Work Required During a Non-Match | p. 230 |
| Being More Specific | p. 231 |
| Alternation Can Be Expensive | p. 231 |
| Benchmarking | p. 232 |
| Know What You're Measuring | p. 234 |
| Benchmarking with Java | p. 234 |
| Benchmarking with VB.NET | p. 236 |
| Benchmarking with Python | p. 237 |
| Benchmarking with Ruby | p. 238 |
| Benchmarking with Tcl | p. 239 |
| Common Optimizations | p. 239 |
| No Free Lunch | p. 240 |
| Everyone's Lunch is Different | p. 240 |
| The Mechanics of Regex Application | p. 241 |
| Pre-Application Optimizations | p. 242 |
| Optimizations with the Transmission | p. 245 |
| Optimizations of the Regex Itself | p. 247 |
| Techniques for Faster Expressions | p. 252 |
| Common Sense Techniques | p. 254 |
| Expose Literal Text | p. 255 |
| Expose Anchors | p. 255 |
| Lazy Versus Greedy: Be Specific | p. 256 |
| Split Into Multiple Regular Expressions | p. 257 |
| Mimic Initial-Character Discrimination | p. 258 |
| Use Atomic Grouping and Possessive Quantifiers | p. 259 |
| Lead the Engine to a Match | p. 260 |
| Unrolling the Loop | p. 261 |
| Building a Regex From Past Experiences | p. 262 |
| The Real "Unrolling-the-Loop" Pattern | p. 263 |
| A Top-Down View | p. 266 |
| An Internet Hostname | p. 267 |
| Observations | p. 268 |
| Using Atomic Grouping and Possessive Quantifiers | p. 268 |
| Short Unrolling Examples | p. 270 |
| Unrolling C Comments | p. 272 |
| The Freeflowing Regex | p. 277 |
| A Helping Hand to Guide the Match | p. 277 |
| A Well-Guided Regex is a Fast Regex | p. 279 |
| Wrapup | p. 280 |
| In Summary: Think! | p. 281 |
| Perl | p. 283 |
| Regular Expressions as a Language Component | p. 285 |
| Perl's Greatest Strength | p. 286 |
| Perl's Greatest Weakness | p. 286 |
| Perl's Regex Flavor | p. 286 |
| Regex Operands and Regex Literals | p. 288 |
| How Regex Literals Are Parsed | p. 292 |
| Regex Modifiers | p. 292 |
| Regex-Related Perlisms | p. 293 |
| Expression Context | p. 294 |
| Dynamic Scope and Regex Match Effects | p. 295 |
| Special Variables Modified by a Match | p. 299 |
| The qr/.../ Operator and Regex Objects | p. 303 |
| Building and Using Regex Objects | p. 303 |
| Viewing Regex Objects | p. 305 |
| Using Regex Objects for Efficiency | p. 306 |
| The Match Operator | p. 306 |
| Match's Regex Operand | p. 307 |
| Specifying the Match Target Operand | p. 308 |
| Different Uses of the Match Operator | p. 309 |
| Iterative Matching: Scalar Context, with /g | p. 312 |
| The Match Operator's Environmental Relations | p. 316 |
| The Substitution Operator | p. 318 |
| The Replacement Operand | p. 319 |
| The /e Modifier | p. 319 |
| Context and Return Value | p. 321 |
| The Split Operator | p. 321 |
| Basic Split | p. 322 |
| Returning Empty Elements | p. 324 |
| Split's Special Regex Operands | p. 325 |
| Split's Match Operand with Capturing Parentheses | p. 326 |
| Fun with Perl Enhancements | p. 326 |
| Using a Dynamic Regex to Match Nested Pairs | p. 328 |
| Using the Embedded-Code Construct | p. 331 |
| Using local in an Embedded-Code Construct | p. 335 |
| A Warning About Embedded Code and my Variables | p. 338 |
| Matching Nested Constructs with Embedded Code | p. 340 |
| Overloading Regex Literals | p. 341 |
| Problems with Regex-Literal Overloading | p. 344 |
| Mimicking Named Capture | p. 344 |
| Perl Efficiency Issues | p. 347 |
| "There's More Than One Way to Do It" | p. 348 |
| Regex Compilation, the /o Modifier, qr/.../, and Efficiency | p. 348 |
| Understanding the "Pre-Match" Copy | p. 355 |
| The Study Function | p. 359 |
| Benchmarking | p. 360 |
| Regex Debugging Information | p. 361 |
| Final Comments | p. 363 |
| Java | p. 365 |
| Judging a Regex Package | p. 366 |
| Technical Issues | p. 366 |
| Social and Political Issues | p. 367 |
| Object Models | p. 368 |
| A Few Abstract Object Models | p. 368 |
| Growing Complexity | p. 372 |
| Packages, Packages, Packages | p. 372 |
| Why So Many "Perl5" Flavors? | p. 375 |
| Lies, Damn Lies, and Benchmarks | p. 375 |
| Recommendations | p. 377 |
| Sun's Regex Package | p. 378 |
| Regex Flavor | p. 378 |
| Using java.util.regex | p. 381 |
| The Pattern.compile() Factory | p. 383 |
| The Matcher Object | p. 384 |
| Other Pattern Methods | p. 390 |
| A Quick Look at Jakarta-ORO | p. 392 |
| ORO's Perl5Util | p. 392 |
| A Mini Perl5Util Reference | p. 393 |
| Using ORO's Underlying Classes | p. 397 |
| .NET | p. 399 |
| .NET's Regex Flavor | p. 400 |
| Additional Comments on the Flavor | p. 402 |
| Using .NET Regular Expressions | p. 407 |
| Regex Quickstart | p. 407 |
| Package Overview | p. 409 |
| Core Object Overview | p. 410 |
| Core Object Details | p. 412 |
| Creating Regex Objects | p. 413 |
| Using Regex Objects | p. 415 |
| Using Match Objects | p. 421 |
| Using Group Objects | p. 424 |
| Static "Convenience" Functions | p. 425 |
| Regex Caching | p. 426 |
| Support Functions | p. 426 |
| Advanced .NET | p. 427 |
| Regex Assemblies | p. 428 |
| Matching Nested Constructs | p. 430 |
| Capture Objects | p. 431 |
| Index | p. 433 |
| Table of Contents provided by Syndetics. All Rights Reserved. |