Regular Expressions glossary
30 terms you will meet in the free Regular Expressions course, each explained in one or two sentences.
A
- Alternation
- The | operator, which matches either the expression on its left or the one on its right.
- Anchor
- A zero-width assertion that matches a position, such as ^ for the start and $ for the end of a string or line.
B
- Backreference
- A reference such as \1 that matches the exact text captured earlier by a group.
- Backtracking
- The engine's strategy of returning to an earlier choice point and trying another option when a match attempt fails.
C
- Capturing group
- A part of a pattern in parentheses whose matched text is saved and numbered for later use.
- Catastrophic backtracking
- An explosion in the number of backtracking steps, often caused by nested quantifiers, that makes matching extremely slow.
- Character class
- A set of characters in square brackets that matches any one of them, such as [aeiou].
E
- Escape
- A backslash placed before a metacharacter so it is matched literally, as in \. for a dot.
F
- Flag
- A modifier that changes how a whole pattern matches, such as i for ignore case or g for global.
- Flavor
- A particular regex dialect, such as POSIX, PCRE, JavaScript or Python, with its own syntax details and features.
G
- Greedy quantifier
- A quantifier that matches as much as possible, giving back characters only when needed.
L
- Lazy quantifier
- A quantifier followed by ?, such as *?, that matches as little as possible.
- Literal
- A character in a pattern that matches itself, such as a letter or digit.
- Lookahead
- An assertion, (?=...) or (?!...), that checks what follows the current position without consuming it.
- Lookbehind
- An assertion, (?<=...) or (?<!...), that checks what precedes the current position without consuming it.
M
- Metacharacter
- A character with special meaning in regex, such as . * + ? ^ $ ( ) [ ] { } | and the backslash.
- Multiline mode
- A flag that makes ^ and $ match at the start and end of each line instead of the whole string.
N
- Named group
- A capturing group with a label, such as (?<year>\d{4}), that can be read by name.
- Negated class
- A character class starting with ^ that matches any one character not in the set, such as [^0-9].
- Non-capturing group
- A group written (?:...) that groups part of a pattern without saving its match.
Q
- Quantifier
- A symbol that sets how many times the previous item may repeat: *, +, ?, {n} or {n,m}.
R
- Raw string
- A Python string literal prefixed with r in which backslashes are kept as typed, used for regex patterns.
- ReDoS
- Regular expression denial of service: an attack that sends input designed to trigger catastrophic backtracking.
- Regex engine
- The software inside a language or tool that runs a pattern against text.
- Regular expression
- A pattern written in a small language that describes a set of strings, used to search, validate, extract and replace text.
S
- Shorthand class
- A short escape for a common class: \d for digits, \w for word characters, \s for whitespace, and their uppercase negations.
U
- Unicode property escape
- An escape such as \p{L} that matches characters by Unicode category, like letters in any script.
V
- Verbose mode
- A flag that ignores whitespace and allows comments inside a pattern for readability.
W
- Word boundary
- The assertion \b, which matches a position between a word character and a non-word character or the string edge.
Z
- Zero-width assertion
- A pattern element that tests a condition at a position but matches no characters, like anchors and lookarounds.
Put these terms to work
The Regular Expressions course uses every one of these terms in short lessons with instant-feedback questions. It takes about 165 minutes and ends with a free certificate of completion.
Start the course Course overview