Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
ECMAScript (JavaScript)

/
(^(?:[01]\d|2[0-3]|[0-59]):[0-5]\d:[0-5]\d)|(^(?:[0-5]\d|2[123]|[0-59]):[0-5]\d)
/
gm

Description

Used in JS context to extract time from string metadata aka YouTube chapters. Trailing text and chars are ignored for each new line.

Submitted by JVE - 2 years ago (Last modified 2 years ago)