24-hour times HH:MM
A regex exercise from Regexdrill. Solve it with a pattern box with live highlighting in your browser, checked against hidden test strings, and it is checked the moment you submit.
The task
The whole line must match. Match a 24-hour time from 00:00 to 23:59 with two-digit hours and minutes.
What this exercise teaches
(?:[01]\d|2[0-3]):[0-5]\d covers every valid hour and minute and nothing else.
A hint if you get stuck
Hours are 00 to 19 or 20 to 23. Minutes start with 0 to 5.
This exercise is part of Pro
Pro unlocks all 52 exercises, with worked solutions and progress saved to your account. The free exercises work without an account.
You create a free account first, so Pro is attached to it.
Monthly is charged today and then every month until you cancel, in one click from your account page. Lifetime is one payment with no renewals. Full refund within 14 days of paying.