$re = '/Duration:\s{1}(\d+?):(\d+?):(\d+\.\d+?),/m';
$str = ' Metadata:
major_brand : isom
minor_version : 0
compatible_brands: mp41avc1
creation_time : 2017-02-01T11:29:03.000000Z
playback_requirements: QuickTime 6.0 or greater
playback_requirements-eng: QuickTime 6.0 or greater
encoder : vlc 2.2.4 stream output
encoder-eng : vlc 2.2.4 stream output
Duration: 00:00:12.52, start: 0.000000, bitrate: 3597 kb/s
Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 3475 kb/s, 21.57 fps, 23.98 tbr, 1000k tbn, 47.95 tbc (default)
Metadata:
creation_time : 2017-02-01T11:29:03.000000Z
handler_name : VideoHandler
Stream #0:1(jpn): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s (default)
Metadata:
creation_time : 2017-02-01T11:29:03.000000Z
handler_name : SoundHandler';
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