У меня есть несколько сотен строк из файла субтитров VTT, пример из заголовка:
00:01:03.500 --> 00:01:03.510 align:start position:0%
<c.colorCCCCCC>fourth guess it came from a broken</c><c.colorE5E5E5> home
</c>
00:01:03.510 --> 00:01:08.140 align:start position:0%
<c.colorCCCCCC>fourth guess it came from a broken</c><c.colorE5E5E5> home
a<00:01:04.580><c> father</c><00:01:05.580><c> not</c><00:01:05.820><c> being</c><00:01:05.880><c> there</c><00:01:06.890><c> my</c><00:01:07.890><c> mother</c></c>
00:01:08.140 --> 00:01:08.150 align:start position:0%
a<c.colorE5E5E5> father not being there my mother
</c>
00:01:08.150 --> 00:01:13.429 align:start position:0%
a<c.colorE5E5E5> father not being there my mother</c>
<c.colorE5E5E5>getting<00:01:09.150><c> married</c><00:01:09.630><c> and</c><00:01:11.360><c> the</c><00:01:12.360><c> abuse</c></c><c.colorCCCCCC><00:01:12.659><c> started</c><00:01:13.049><c> at</c></c>
00:01:13.429 --> 00:01:13.439 align:start position:0%
<c.colorE5E5E5>getting married and the abuse</c><c.colorCCCCCC> started at
</c>
Файлы субтитров VTT довольно запутанны, но цель состоит в том, чтобы собрать все слова внутри тегов меток времени и самих меток времени.
Я думал, preg матч, но не знаю, как это сделать
$pattern = "<([^;]*)>";
preg_match_all($pattern, $lineContent, $allintag);
Это то, что я получил, но остановился там.
array(
00:01:03.510,
00:01:04.580,
00:01:05.58,
00:01:05.820,
00:01:05.880,
00:01:06.890,
00:01:07.890,
00:01:08.140,
00:01:09.150,
00:01:09.630,
00:01:11.360,
00:01:12.360,
00:01:12.659,
00:01:13.049
)
array(
'fourth guess it came from a broken home',
'father',
'not',
'being',
'there',
'my',
'mother',
'getting',
'married',
'and',
'the',
'abuse',
'started',
'at'
)