Regular Expressions 101

Validation of Date in the format YYYY-MM-DD

Open Workspace
  • PCRE2 (PHP)
  • Match
0

Regular Expression

/
(?<=(^19\d\d|^20\d\d)-02-)(0[1-9]|1[0-9]|2[0-9])$|^(19\d\d|20\d\d)-(0[469]|11)-(0[1-9]|1[0-9]|2[0-9]|30)$|^(19\d\d|20\d\d)-(0[13578]|12)-(0[1-9]|1[0-9]|2[0-9]|3[01])$
/
gm

Description

Validation of Date in the format YYYY-MM-DD

Submitted by David