Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
PCRE2 (PHP >=7.3)

/
^PT(?>(?'hours'\d+)(?>H))?(?>(?'minutes'\d+)(?>M))?(?>(?'seconds'\d+)(?>S))?
/
gm

Description

Convert the YouTube API V3 videos list, duration of videos to separate numbers for calculations.

Submitted by Bo - 2 years ago