Regular Expressions 101

Community Patterns

Community Library Entry

1

Regular Expression
PCRE (PHP <7.3)

/
^((0?[1-9]{1})|(1{1}[0-2]{1}))((:[0-5][0-9])?)(A|P)$
/
i

Description

matches time in 12 hour format For Eg: 1a 1A 1p 1P 01a 01:12a 02:59p

Submitted by Pooja Khorjuvekar - 9 years ago