REAL-WORLD CHALLENGES
Email addresses
Pull email addresses out of free text with sets, quantifiers and escaping.
Extract email addresses from a line. Think in three pieces: a local part before the @, the @ itself, then a domain that ends in a dot and a top-level suffix. A workable shape is [\w.+-]+@[\w.-]+\.\w{2,} - word characters plus a few punctuation marks, an @, a domain, an escaped dot, then at least two more characters.
A regex checks shape, not validity: this pattern accepts "a@b.io" and would also accept addresses no mail server could deliver. Fully RFC-correct email matching is famously gnarly - for everyday extraction this practical shape is what you actually want.
Match every email address in the line.
contact jane.doe@example.com please
two: a@b.io and c.d+tag@sub.domain.org
no email here, just text
sign alone @ and word
Match only the domain of each email - the part after the @, with the @ excluded.
jane@example.com and bob@mail.co.uk
reach support@acme.io now
no domains here