Adrian Sarli Adrian Sarli - 1 year ago 126
PHP Question

How do you match 12 hour time hh:mm in a regex?

How could you match 12 hour time in a regex-- in other words match 12:30 but not 14:74?
Thanks!

Answer Source

This should work:

([1-9]|1[012]):[0-5][0-9]
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download