Community Patterns

Community Library Entry

2

Regular Expression
Created·2023-01-28 18:16
Updated·2023-01-28 18:31
Flavor·ECMAScript (JavaScript)

/
^(?<CompleteMatch>(?:(?<DateMonthYear>\d{4}-\d{2}-\d{2})T(?<Time>\d{2}:\d{2}:\d{2}(?:\.\d+)?))(?<TimeZone>Z|[\+-]\d{2}:\d{2})?)$
/
gm
Open regex in editor

Description

Regex to validate a string that is RFC3339 compliant in JavaScript. RFC3339: https://www.rfc-editor.org/rfc/rfc3339. Expands upon: https://regex101.com/r/qH0sU7 by adding named capture groups for coding best practices.

Submitted by Elliot Huffman