Community Patterns

Community Library Entry

1

Regular Expression
Created·2016-03-29 10:45
Flavor·PCRE (Legacy)

/
^\d{4}-(0\d|1[0-2])-([0-2]\d|3[0-2])(T(([01]\d|2[0-4]):([0-5]\d)(:[0-5]\d([\.,]\d+)?)?|([01]\d|2[0-4])(:[0-5]\d([\.,]\d+)?)?|([01]\d|2[0-4])([\.,]\d+)?))?([+-]\d\d(:[0-5]\d)?|Z)?$
/
Open regex in editor

Description

Matches an ISO8601 date time string, including fractional time. Does not exclude non-existent times (such as the 29th february in non-leap-years)

Submitted by Tobias Marstaller