Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
PCRE (PHP <7.3)

/
(?'Year'[0-9]+)-(?'Month'0{0,1}[1-9]|10|11|12)-(?'Day'[0-2]{0,1}[1-9]|10|20|30|31)-(?'Hour'[01]{0,1}[0-9]|2[0-3])-(?'Minute'[0-5]{0,1}[0-9])-(?'Second'[0-5]{0,1}[0-9])
/

Description

Validates DateTime in format 'yyyy-M-d-HH-mm-ss'(.NET) in mind with possible zeros, minimal values, maximal values and infinite year

Submitted by CryoCZ - 9 years ago