Regular Expressions 101

Community Patterns

Checking time for AM/PM format

0

Regular Expression
PCRE2 (PHP >=7.3)

/
^\b(0?\d|1[0-2]):[0-5]\d(\s)?([AaPp][Mm]$)
/
mg

Description

Support both capital and small letters, could be 01:00AM of 1:00AM

Submitted by VS - a year ago