Time HH:mm regex pattern

Copy and test a JavaScript regex for 24-hour HH:mm times, with examples and a one-click link to the regex tester.

Time HH:mm regex pattern

Validate whole value

Use anchors to check whether the complete value matches.

Regex: ^(?:[01]\d|2[0-3]):[0-5]\d$

Flags: -

Search in text

Find matching fragments inside a larger block of text.

Regex: \b(?:[01]\d|2[0-3]):[0-5]\d\b

Flags: g

Examples that match

  • 09:30
  • 23:59

Examples that do not match

  • 24:00
  • 9:30