REAL-WORLD CHALLENGES

ISO dates

Extract structured data from messy text.

Pull every ISO date (YYYY-MM-DD) out of a log line. The shape is rigid: four digits, dash, two digits, dash, two digits. Counted repetition was built for this.

A regex checks shape, not meaning: 9999-99-99 has the right shape and would match. Validating that a date is REAL is a job for the surrounding code, not the pattern. Knowing where that line sits is part of mastering regex.

EXERCISE

Match every ISO date.

/ /
deployed 2026-06-11, rollback to 2025-12-01
must match: "2026-06-11" "2025-12-01"
meeting on 11/06/2026
must match nothing
version 12-34 shipped
must match nothing