Regular Expressions 101

Community Patterns

ISO8601 Date/Time Parser

0

Regular Expression
Python

r"
(\d{4}(-\d{2}-\d{2}|\d{2}\d{2}))(T\d{2}(:?\d{2}){1,2}(\.\d{1,3})?(([+-]\d{2}(:?\d{2})?)|Z)?)?
"
gm

Description

Parses most of the variations of ISO8601 that are allowed, including dates only and date/time with or without the time zone.

Submitted by Mumblepins - 2 years ago