Regular Expressions 101

Community Patterns

1...34567...902

Community Library Entry

0

Regular Expression
PCRE (PHP <7.3)

/
^(\d{4})\-(0?[1-9]|1[012])\-(0?[1-9]|[12][0-9]|3[01]) ([0-1][0-9]|[2][0-3]):([0-5][0-9]):([0-5][0-9])$
/
g

Description

Validation for date and time string "yyyy-MM-dd HH:mm:ss"

Submitted by jist - 7 years ago