$re = '/((\d\d:){2}\d\d,\d\d\d| --> )+(?=(?:$\n.+)+chemical)/m';
$str = '"1
00:01:46,356 --> 00:01:49,893
What is this? It\'s blue.
2
00:01:50,794 --> 00:01:54,998
We used a different chemical process,
but it is every bit as pure.
3
00:01:55,199 --> 00:01:58,267
It may be blue, but it\'s the bomb."';
preg_match_all($re, $str, $matches, PREG_SET_ORDER, 0);
// Print the entire match result
var_dump($matches);
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for PHP, please visit: http://php.net/manual/en/ref.pcre.php