1
我想用正則表達式解析字幕。但不匹配多行文字。用正則表達式解析字幕(srt)
正則表達式代碼:
(?<order>(\d+))\n(?<start>([\d:,]+))[\s-{2}\>]+(?<end>([\d:,]+))\n(?<text>(.+|\n))
https://regex101.com/r/jV9oV2/2
我想用正則表達式解析字幕。但不匹配多行文字。用正則表達式解析字幕(srt)
正則表達式代碼:
(?<order>(\d+))\n(?<start>([\d:,]+))[\s-{2}\>]+(?<end>([\d:,]+))\n(?<text>(.+|\n))
https://regex101.com/r/jV9oV2/2
(?<order>\d+)\n(?<start>[\d:,]+)\s+-{2}\>\s+(?<end>[\d:,]+)\n(?<text>[\s\S]*?(?=\n{2}|$))
您可以修改您正則表達式這樣搶text
。看到演示。
很好。感謝您的編輯。 –