Regular Expressions 101

Community Patterns

Community Library Entry

2

Regular Expression
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

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 - 2 years ago (Last modified 2 years ago)