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 regex?
Any single character except newline (by default). Use the DOTALL/s flag to include newlines.
What's the difference between * and +?
* matches zero or more occurrences; + matches one or more occurrences. Both are greedy by default.
How do you make a quantifier non-greedy?
Add a ? after the quantifier: *?, +?, ??, {n,m}?. Non-greedy matches the shortest possible string.
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.
How do character classes [abc] and [^abc] differ?
[abc] matches any one character in the set; [^abc] matches any one character NOT in the set (negation).
What's the gotcha with () vs (?:)?
Both group, but () creates a capturing group (stored in memory/backreferences); (?:) is non-capturing and more efficient.
Explain backreferences with an example.
\1, \2, etc. refer to previously captured groups. Example: (\w+) \1 matches repeated words like 'hello hello'.
Why does .* at the end of a pattern often fail to match what you expect?
By default .* is greedy and matches as much as possible; this can consume characters your later pattern needs. Use .*? (non-greedy) or be more specific.
What's the difference between ^ and \A, and between $ and \z?
^ and $ match line boundaries (start/end of each line in multiline mode); \A and \z match only string start/end, regardless of flags.
What common mistake happens with character class ranges like [a-z0-9_-]?
The hyphen - must be escaped or placed at the start/end to be literal; [a-z0-9_\-] or [a-z0-9_-] (at end) avoid unintended ranges like 0-_ (invalid).
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 →