Regular Expressions: Commentary

Steven Zeil

Last modified: Jun 16, 2020
Contents:

The concept of regular expressions should be familiar to you from their use in sed, grep, and other common Unix commands.

C++ compilers, until recently, had no equivalent to these in their standard library. The C++11 standard introduced some classes very similar to the Java ones.

1 Introduction

If you find the description here less than exciting, you might want to return to this earlier discussion where we faced the problem of describing the set of all strings consisting of one or more adjacent occurrences of a whitespace character, a left or right parenthesis, or a comma. That’s the sort of text matching at which regular expressions really excel.

2 Test Harness

3 String Literals

4 Character Classes

5 Predefined Character Classes

6 Quantifiers

7 Capturing Groups

8 Boundary Matchers

9 Methods of the Pattern Class

10 Methods of the Matcher Class

11 Methods of the PatternSyntaxException Class

12 Unicode Support

13 Additional Resources