$re = '/Track number:(?:.(?!Track number:))*subtitles/s';
$str = '+ EBML head
|+ EBML version: 1
|+ EBML read version: 1
|+ EBML maximum ID length: 4
|+ EBML maximum size length: 8
|+ Doc type: matroska
|+ Doc type version: 2
|+ Doc type read version: 2
+ Segment, size 467658217
|+ Seek head (subentries will be skipped)
|+ EbmlVoid (size: 4029)
|+ Segment information
| + Timecode scale: 1000000
| + Muxing application: libebml v1.0.0 + libmatroska v1.0.0
| + Writing application: mkvmerge v4.0.0 (\'The Stars were mine\') built on Jun 6 2010 16:18:42
| + Duration: 5819.819s (01:36:59.819)
| + Date: Sat Jul 3 16:19:00 2010 UTC
| + Segment UID: 0xae 0x0c 0xfb 0x11 0x90 0x39 0x93 0x1b 0x89 0xa4 0xb1 0xaa 0xa0 0x79 0x3d 0x42
|+ Segment tracks
| + A track
| + Track number: 1 (track ID for mkvmerge & mkvextract: 0)
| + Track UID: 863185562
| + Track type: video
| + Default flag: 0
| + Lacing flag: 0
| + MinCache: 1
| + Codec ID: V_MPEG4/ISO/AVC
| + CodecPrivate, length 41 (h.264 profile: High @L3.1)
| + Default duration: 41.708ms (23.976 frames/fields per second for a video track)
| + Language: und
| + Video track
| + Pixel width: 1280
| + Pixel height: 534
| + Display width: 1280
| + Display height: 534
| + A track
| + Track number: 2 (track ID for mkvmerge & mkvextract: 1)
| + Track UID: 3319793313
| + Track type: audio
| + Default flag: 0
| + Codec ID: A_AAC
| + CodecPrivate, length 7
| + Default duration: 42.667ms (23.438 frames/fields per second for a video track)
| + Audio track
| + Sampling frequency: 24000
| + Channels: 2
| + Output sampling frequency: 48000
| + A track
| + Track number: 3 (track ID for mkvmerge & mkvextract: 2)
| + Track UID: 1382186431
| + Track type: subtitles
| + Lacing flag: 0
| + Codec ID: S_TEXT/UTF8
|+ EbmlVoid (size: 1122)
|+ Chapters
| + EditionEntry
| + EditionFlagHidden: 0
| + EditionFlagDefault: 0
| + EditionUID: 2614993839
| + ChapterAtom
| + ChapterUID: 2912241034
| + ChapterTimeStart: 00:00:00.097000000
| + ChapterFlagHidden: 0
| + ChapterFlagEnabled: 1
| + ChapterDisplay
| + ChapterString: 00:00:00.097
| + ChapterLanguage: eng
|+ EbmlVoid (size: 101)
|+ Cluster
|+
| + A track
| + Track number: 2 (track ID for mkvmerge & mkvextract: 1)
| + Track UID: 3319793313
| + Track type: audio
| + Default flag: 0
| + Codec ID: A_AAC
| + CodecPrivate, length 7
| + Default duration: 42.667ms (23.438 frames/fields per second for a video track)
| + Audio track
| + Sampling frequency: 24000
| + Channels: 2
| + Output sampling frequency: 48000
+ EBML head
|+ EBML version: 1
|+ EBML read version: 1
|+ EBML maximum ID length: 4
|+ EBML maximum size length: 8
|+ Doc type: matroska
|+ Doc type version: 2
|+ Doc type read version: 2
+ Segment, size 467658217
|+ Seek head (subentries will be skipped)
|+ EbmlVoid (size: 4029)
|+ Segment information
| + Timecode scale: 1000000
| + Muxing application: libebml v1.0.0 + libmatroska v1.0.0
| + Writing application: mkvmerge v4.0.0 (\'The Stars were mine\') built on Jun 6 2010 16:18:42
| + Duration: 5819.819s (01:36:59.819)
| + Date: Sat Jul 3 16:19:00 2010 UTC
| + Segment UID: 0xae 0x0c 0xfb 0x11 0x90 0x39 0x93 0x1b 0x89 0xa4 0xb1 0xaa 0xa0 0x79 0x3d 0x42
|+ Segment tracks
| + A track
| + Track number: 1 (track ID for mkvmerge & mkvextract: 0)
| + Track UID: 863185562
| + Track type: video
| + Default flag: 0
| + Lacing flag: 0
| + MinCache: 1
| + Codec ID: V_MPEG4/ISO/AVC
| + CodecPrivate, length 41 (h.264 profile: High @L3.1)
| + Default duration: 41.708ms (23.976 frames/fields per second for a video track)
| + Language: und
| + Video track
| + Pixel width: 1280
| + Pixel height: 534
| + Display width: 1280
| + Display height: 534
| + A track
| + Track number: 2 (track ID for mkvmerge & mkvextract: 1)
| + Track UID: 3319793313
| + Track type: audio
| + Default flag: 0
| + Codec ID: A_AAC
| + CodecPrivate, length 7
| + Default duration: 42.667ms (23.438 frames/fields per second for a video track)
| + Audio track
| + Sampling frequency: 24000
| + Channels: 2
| + Output sampling frequency: 48000
| + A track
| + Track number: 3 (track ID for mkvmerge & mkvextract: 2)
| + Track UID: 1382186431
| + Track type: subtitles
| + Lacing flag: 0
| + Codec ID: S_TEXT/UTF8
|+ EbmlVoid (size: 1122)
|+ Chapters
| + EditionEntry
| + EditionFlagHidden: 0
| + EditionFlagDefault: 0
| + EditionUID: 2614993839
| + ChapterAtom
| + ChapterUID: 2912241034
| + ChapterTimeStart: 00:00:00.097000000
| + ChapterFlagHidden: 0
| + ChapterFlagEnabled: 1
| + ChapterDisplay
| + ChapterString: 00:00:00.097
| + ChapterLanguage: eng
|+ EbmlVoid (size: 101)
|+ Cluster
|+
| + A track
| + Track number: 2 (track ID for mkvmerge & mkvextract: 1)
| + Track UID: 3319793313
| + Track type: audio
| + Default flag: 0
| + Codec ID: A_AAC
| + CodecPrivate, length 7
| + Default duration: 42.667ms (23.438 frames/fields per second for a video track)
| + Audio track
| + Sampling frequency: 24000
| + Channels: 2
| + Output sampling frequency: 48000
';
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