Skip to the workspace
Pebellslearn by building

Python syntax & reference

Find the form you need, compare how it behaves, and open the complete explanation when you need more depth.

Python 3.10+ syntax; individual entries identify newer features. Browser exercises use the configured Python runner.

1 matching syntax entry

Regex matching and extraction

Learn in depth →

Regular expressions recognize text patterns; fullmatch checks the entire input.

re.search(pattern, text); re.fullmatch(pattern, text)

Example

import re
print(bool(re.fullmatch(r"[A-Z]{2}[0-9]{3}", "AB123")))
print(re.findall(r"[0-9]+", "a12 b7"))

Result

True
['12', '7']

Watch for: search can match a substring. Avoid ambiguous nested repetition with untrusted inputs; a match is not domain validation.

Practise this topic →
Complete explanation index (91 lessons indexed)

Regular Expressions

Technical sources and review date

Original Pebells examples. Reviewed 2026-10-28.

Hover to wake the cannons. Drag to move, or use arrow keys when focused. Press Enter to fire a shot.