Regular Expressions 101

Community Patterns

Community Library Entry

1

Regular Expression
PCRE (PHP <7.3)

/
^(?:([0-9]{1,4})(\/|-|.|\S)([0-9]{1,2})(\/|-|.|\S)([0-9]{1,4}))
/
gm

Description

Validate and capture different dates without words for example: dd/mm/yyyy, d/m/yy, yyyy-mm-dd, yy-mm-dd

Submitted by anonymous - 5 years ago