Regular Expressions 101

Community Patterns

Community Library Entry

1

Regular Expression
PCRE (PHP <7.3)

/
(^(0?[1-9]|[12][0-9]|3[01])\.(0?[1-9]|1[012])\.(19|20)\d\d( ([01]?[0-9]|2[0-3]):[0-5][0-9])?$|^\{ts \'((19|20)\d\d)\-(0?[1-9]|1[012])\-(0?[1-9]|[12][0-9]|3[01]) ([01]?[0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]\'\}$|^$)
/

Description

Matches european dates (DD.MM.YYYY[ HH:MM:SS]) and MS-SQL Timestamp ({ts 'YYYY-MM-DD HH:MM:SS'})

Submitted by anonymous - 10 years ago