Find the first 4-digit year in the text.
Hint: use re.search() with a pattern like \d{4}.
Extract all numbers from the text as a list.
Hint: use re.findall() with \d+.
Replace all years with the word YEAR.
Hint: use re.sub().
Check if a code matches exactly two uppercase letters, dash, four digits.
Hint: use re.fullmatch() with r"[A-Z]{2}-\d{4}".
Find words that start with capital A.
Hint: use an anchor and word characters.
Extract whole-word cat matches only (not scatter or bobcat).
Hint: use word boundaries \b.
Extract all emails from the text.
Hint: start from \w+@\w+\.\w+.
Use capturing groups to extract year, month, and day from a date.
Hint: pattern like (\d{4})-(\d{2})-(\d{2}).
Show the difference between greedy and lazy matching on HTML tags.
Hint: compare <.*> and <.*?>.
Mini challenge: validate Greek phone numbers in format 210-123-4567 from a list and print only valid ones.
Hint: use re.fullmatch() in a loop.
Chapter Navigation
Move between chapters.