Quick Reference
Character Representations
| Two-digit hexadecimal code |
| Four-digit hexadecimal code (Unicode) |
Character Classes
| A single character or a group of characters |
| Exclude single character or a group of characters |
| Any character except paragraph break |
| Word character: letters, digits, and underline |
| Nonword character |
| Lowercase letter |
| Not lowercase letter |
| Uppercase letter |
| Not uppercase letter |
| Digit |
| Nondigit |
| Whitespace (all spaces, tabs, returns) |
| Non-whitespace character |
Location Markers
| Beginning of paragraph |
| End of paragraph |
| Word boundary |
| Not word boundary |
| Beginning of word |
| End of word |
| Beginning of story |
| End of story |
| Positive lookahead |
| Negative lookahead |
| Positive lookbehind |
| Negative lookahead |
| Group a pattern and capture matches into |
| In an expression, contains the text matched by the |
| In a replacement string, contains the text matched by the |
| Group a subpattern, but don't capture match |
| Alternatives |
| Match 0 times or more |
| Match 1 time or more |
| Match 0 or 1 times |
| Match exactly |
| Match at least |
| Match at least |
| Match 0 or 1 times, but as few as possible |
| Match 1 time or more, but as few as possible |
| Match 0 or 1 times, but as few as possible |
| Match at least |
| Match at least |
Modifiers
| Case-insensitive match ... |
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access