Preface .ix
1. Introduction to Regular Expressions 1
Regular Expressions Defined 1
Search and Replace with Regular Expressions 6
Tools for Working with Regular Expressions 8
2. Basic Regular Expression Skills 27
2.1 Match Literal Text 28
2.2 Match Nonprintable Characters 30
2.3 Match One of Many Characters 33
2.4 Match Any Character 38
2.5 Match Something at the Start and/or the End of a Line 40
2.6 Match Whole Words 45
2.7 Unicode Code Points, Categories, Blocks, and Scripts 48
2.8 Match One of Several Alternatives 62
2.9 Group and Capture Parts of the Match 63
2.10 Match Previously Matched Text Again 66
2.11 Capture and Name Parts of the Match 68
2.12 Repeat Part of the Regex a Certain Number of Times 72
2.13 Choose Minimal or Maximal Repetition 75
2.14 Eliminate Needless Backtracking 78
2.15 Prevent Runaway Repetition 81
2.16 Test for a Match Without Adding It to the Overall Match 84
2.17 Match One of Two Alternatives Based on a Condition 91
2.18 Add Comments to a Regular Expression 93
2.19 Insert Literal Text into the Replacement Text 95
2.20 Insert the Regex Match into the Replacement Text 98
2.21 Insert Part of the Regex Match into the Replacement Text 99
2.22 Insert Match Context into the Replacement Text 103
......