Regular Expressions 101

Community Patterns

Community Library Entry

1

Regular Expression
PCRE2 (PHP >=7.3)

/
^(1[0-2]|0?[1-9]):[0-5][0-9] (AM|PM)$
/
gm

Description

Use this expression to validate a 12 hour time input

Submitted by Amit Sharma - a year ago