Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
ECMAScript (JavaScript)

/
(?:^(?<year>-?(?:[1-9][0-9]*)?[0-9]{4})-(?<month>1[0-2]|0[1-9])-(?<date>3[01]|0[1-9]|[12][0-9])T(?<hours>2[0-3]|[01][0-9]):(?<minutes>[0-5][0-9]):(?<seconds>[0-5][0-9])\.(?<ms>[0-9]+)?)(?<offset>Z|[+-][0-5][0-9](?::?[0-5][0-9])?)?$
/
gm

Description

Matches strings in the ISO_8601 format. Named capture groups for year, month, date, hours, minutes, seconds, ms and timezone offset.

Submitted by anonymous - 6 years ago