Regular Expressions 101

Community Patterns

Validation for full ISO8601 date and time with timezone

1

Regular Expression
ECMAScript (JavaScript)

/
^(?:19|20)\d{2}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12]\d|3[01])T(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:Z|-0[1-9]|-1\d|-2[0-3]|-00:?(?:0[1-9]|[1-5]\d)|\+[01]\d|\+2[0-3])(?:|:?[0-5]\d)$
/
gm

Description

The RegExp validates ISO8601 date and time (without milliseconds) with timezone offset.

Submitted by pioneer32 - 8 years ago