Regular Expressions 101

Community Patterns

Datetime regex

0

Regular Expression
Python

r"
([1|2]\d{3})\/((0[1-9])|(1[0-2]))\/([0][1-9]|([1-2]\d)|(3[0-1]))T(([0-1]\d)|(2[0-3])):([0-5][0-9]):([0-5][0-9])
"
g

Description

Matches dates in the following format: %Y/%m/%dT%H:%M:%S

This is 24h format (00-23h) and no leap seconds.

Submitted by anonymous - 6 years ago