REAL-WORLD CHALLENGES
ISO dates
Extract ISO dates and 24-hour times 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.
PRACTICE - 2 DRILLS 0/2 DONE
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
Match every valid 24-hour time in HH:MM form (00:00 through 23:59).
/ /
job ran 09:30 and finished 23:59
must match: "09:30" "23:59"
cron at 00:00 daily
must match: "00:00"
invalid 24:00 and 9:5 here
must match nothing
no times today
must match nothing