Regular Expressions 101

Community Patterns

Community Library Entry

2

Regular Expression
PCRE (PHP <7.3)

/
([0-9]+)\n([0-9]{2}:[0-9]{2}:[0-9]{2}.[0-9]{3}) --> ([0-9]{2}:[0-9]{2}:[0-9]{2}.[0-9]{3})\n(.*?)\n\n
/
gs

Description

Matches id, timecode and text for multiple subtitles. Make sure the source ends with a blank line to capture the last subtitle.

Submitted by Fergo - 11 years ago