Flashcards · Regular Expressions · Free
Regular Expressions flashcards, generated for you.
Example Regular Expressions study cards to learn from right now — then generate a full set from your own notes (plus a practice quiz) and export to Quizlet or Anki. Free, no account needed.
Example Regular Expressions flashcards
What does the dot (.) match in a regular expression?
Any single character except a newline (by default). Use the DOTALL flag to include newlines.
What is the difference between * and + quantifiers?
* matches 0 or more occurrences; + matches 1 or more occurrences. Both are greedy.
How do you make a quantifier non-greedy (lazy)?
Add a ? after the quantifier: *?, +?, ??, or {n,m}?. This matches as few characters as possible.
What does \b represent in regex?
A word boundary—the position between a word character (\w) and a non-word character. Does not consume characters.
What's the difference between [abc] and (abc) in regex?
[abc] is a character class matching any single char a, b, or c. (abc) is a capturing group matching the literal sequence 'abc'.
Why might ^ and $ behave unexpectedly in multiline text?
By default, ^ matches start of string and $ matches end of string. With the MULTILINE flag, they match start/end of each line instead.
What does (?:...) do, and why use it instead of (...)?
(?:...) is a non-capturing group. It groups patterns for quantifiers/alternation but doesn't create a numbered capture group, saving memory.
What is a common gotcha with character classes like [\w-\d]?
The hyphen (-) is interpreted as a range operator, creating an invalid range. To match a literal hyphen, escape it (\-) or place it at the start/end of the class: [\w\-\d] or [\w-].
Why does (a|b)* sometimes match empty strings unexpectedly?
Because * allows 0 occurrences, so the group can match zero times, resulting in an empty match. Use + or explicit quantifiers if you need at least one match.
What is the difference between \1 and $1 in regex?
\1 is a backreference within the regex pattern itself (matches whatever group 1 captured). $1 is the matched group content used in replacement strings or after matching completes.
Make your own Regular Expressions study set
Flashcards for related topics
Studying Regular Expressions to build with AI? MindloomHQ turns it into real skills — structured courses, agent projects, and certificates.
Explore MindloomHQ →