Regular Expressions 101

Community Patterns

Community Library Entry

1

Regular Expression
PCRE (PHP <7.3)

/
^(?:(?:[0-2]\d|[3][0-1]|\d)\.(?:[0][1-9]|[1][0-2]|\d)\.\d*|\d*-(?:[0][1-9]|[1][0-2]|\d)-(?:[0-2]\d|[3][0-1]|\d))$
/
gm

Description

Erkennt Daten der deutschen Schreibweise 10.10.2018 1.2.18 ...

und Daten im Format 2018-04-02 2018-3-2 ...

Submitted by anonymous - 6 years ago