Regular Expressions 101

Community Patterns

ISO Timestamp-ish

0

Regular Expression
ECMAScript (JavaScript)

/
^(?<year>\d{4})[\-\.\/]?(?<month>0[1-9]|1[02])[\-\.\/]?(?<day>[0-2]\d|3[0-1])[ T]?(?<hour>[0-1]\d|2[0-3])[\:\.]?(?<minute>[0-5]\d)[\:\.]?(?<second>[0-5]\d) ?(?<offset>(?<offset_sign>[\-\+]*)(?<offset_hour>0[0-9]|1[0-2])[\:\.]?(?<offset_minute>[0-5]\d))
/
gm

Description

Matches ISO-like timestamp, with or without date and time separators

Submitted by anonymous - 5 years ago