Python: Regular Expressions
Regular expressions are a powerful tool for searching, validating, and transforming text — and Python's re module makes them fully accessible. This quiz covers the syntax of regex patterns and the key functions in the re module.
Questions test knowledge of metacharacters (., *, +, ?, ^, $, []), character classes (\d, \w, \s), groups and capturing, re.search vs re.match vs re.findall, substitution with re.sub, and compiling patterns for reuse.
Regular expressions have a reputation for being hard to read — but once you understand the building blocks, they become an indispensable tool. This quiz tests whether you've crossed that threshold.
What This Quiz Covers
- Metacharacters: . * + ? ^ $ | \ [ ] { } ( )
- Character classes: \d (digit), \w (word), \s (whitespace), \b (boundary)
- Quantifiers: * (0+), + (1+), ? (0 or 1), {n,m} (range)
- Anchors: ^ (start), $ (end), \b (word boundary)
- Groups: capturing () and non-capturing (?:)
- re.search(), re.match(), re.findall(), re.finditer()
- re.sub() for substitution and re.compile() for pattern reuse
Cletica
Want to create your own quiz?
Build surveys and quizzes, share with anyone, collect responses — free to start.
Try Cletica for free →