Extract times from text

Extract times finds every time-of-day token in pasted text and lists each match on its own line. The match rule is \b\d{1,2}:\d{2}(?::\d{2})?(?:\s?[ap]\.?m\.?)?\b: 1 or 2 digits, a colon, two digits, an optional :ss, and an optional am / pm tail. Both 12-hour and 24-hour formats match. The transform runs in your browser.

Input
Line 1:1 LF cloud_done Saved locally
Result Extract Times
0 lines 0 chars

How time matching works here

The pattern accepts an hour of 1 or 2 digits, a literal colon, exactly two digits for minutes, and optionally another colon and two digits for seconds. After the digits, an optional am, pm, a.m. or p.m. tail is allowed (case-insensitive thanks to the i flag). So 7:30pm, 14:30, 03:15:42 and 8:00 a.m. all match.

The matcher is shape-only. It does not validate that hours are 0-23 (or 1-12) or that minutes and seconds are below 60. 25:99 matches the shape and is returned as-is. To validate, post-process in a spreadsheet or use extract regex matches with a stricter pattern that constrains each component.

Word boundaries on each side keep the match clean inside prose. The am/pm tail with optional dots is sometimes ambiguous: 7:30 a.m. matches with the a.m. attached, while 7:30 a alone may capture without the tail because the second m. is missing.

How to use extract times from text

  1. 1Paste the schedule, log or text into the input panel.
  2. 2The output panel shows every time, one per line.
  3. 3Click Copy to copy the list.
  4. 4Click Download to save it as a plain-text file.
  5. 5For unique times only, send the result to remove duplicate lines.

Keyboard shortcuts

Drive TextResult without touching the mouse.

Shortcut Action
Ctrl FOpen the find & replace panel inside the input Plus
Ctrl ZUndo the last input change
Ctrl Shift ZRedo
Ctrl Shift EnterToggle fullscreen focus on the editor Plus
EscClose find & replace, or exit fullscreen
Ctrl KOpen the command palette to jump to any tool Plus
Ctrl SSave current workflow draft Plus
Ctrl PRun a saved workflow Plus

What counts as a time here

Hour and minute, optional seconds

1 or 2 hour digits, colon, exactly 2 minute digits, optional :ss for seconds. 7:30, 14:30, 03:15:42 all match.

12-hour and 24-hour both work

No format flag is needed. 14:30 is captured as 24-hour and 2:30pm is captured as 12-hour. The matcher does not normalise.

Optional am/pm tail (case-insensitive)

am, pm, a.m., p.m., AM, PM all match because the i flag is on. The tail can have an optional space before it: 7:30pm and 7:30 PM are equivalent.

No range validation

Shape-only. 25:99 matches because \d{1,2}:\d{2} is satisfied. To restrict to valid clock values, use extract regex matches with a tighter pattern like \b(?:[01]?\d|2[0-3]):[0-5]\d(?::[0-5]\d)?\b.

Order preserved, duplicates kept

Times appear in source order. Duplicates are not removed; for a unique list pipe through remove duplicate lines.

Worked example

The 12-hour 7:30pm, the bare 24-hour 14:30, and the seconds-precision 03:15:42 all come through. The UTC suffix is dropped because it is outside the pattern.

Input
Doors open at 7:30pm and the show starts at 8:00.
Meeting at 14:30.
Deploy logged at 03:15:42 UTC.
Output
7:30pm
8:00
14:30
03:15:42

Settings reference

Behaviour Effect on output
Hour digits 1 or 2 digits.
Minute digits Exactly 2.
Seconds Optional :ss (exactly 2 digits).
am/pm tail Optional. Case-insensitive. Dots optional. Space before tail optional.
Range validation None. 25:99 matches the shape.
Order and duplicates Source order kept, duplicates kept.

FAQ

Will 11pm (no minutes) match?
No. The pattern requires the HH:MM structure. Bare hours like 11pm or 11 PM are not captured. Use extract regex matches with a pattern like \b\d{1,2}\s?[ap]\.?m\.?\b for hour-only times.
Why does 25:99 match if it is not a real time?
The matcher checks shape, not range. To filter to valid clock values, use extract regex matches with the pattern \b(?:[01]?\d|2[0-3]):[0-5]\d(?::[0-5]\d)?\b.
Are time zones included in the match?
No. UTC, +0100, EST and similar suffixes are outside the pattern, so the time alone is captured. Use extract regex matches with a pattern that includes the timezone if you need it.
Are duplicates removed?
No. Every time is kept in source order. Pipe the result through remove duplicate lines for a unique list.
Is anything sent to a server?
No. The match runs entirely in your browser.