Dates & Timesflags: g
24-Hour Time
Match 24-hour time formats HH:MM or HH:MM:SS with valid hour (00–23) and minute/second (00–59) ranges.
Try it in RegexPro →Available in
Pattern
regexengine-agnostic
(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d)? (flags: g)Raw source: (?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d)?
How it works
Hour alternation enforces 00–23, minute/second classes enforce 00–59. The optional :SS group makes seconds optional.
Examples
Input
14:30Matches
14:30
Input
23:59:59Matches
23:59:59
Input
25:00No match
—Common use cases
- •Log timestamp extraction
- •Scheduling input validation
- •Transit/flight time parsing
- •Analytics time-bucket aggregation
Related patterns
12-Hour Time with AM/PM
Dates & TimesMatch 12-hour time formats with AM or PM suffix — e.g. 9:30 AM, 11:45:15 pm.
European Date Format (DD/MM/YYYY)
Dates & TimesMatch European-style dates in DD/MM/YYYY format with valid day (01–31) and month (01–12) ranges.
ISO 8601 Date
Dates & TimesMatch dates in ISO 8601 format: YYYY-MM-DD with valid month (01–12) and day (01–31) ranges.
ISO 8601 Date-Time
Dates & TimesMatch full ISO 8601 date-times with timezone offset or Z suffix (e.g. 2024-01-15T14:30:00Z).