Parse subtitle file using regex C#

前端 未结 5 521
南笙
南笙 2021-01-26 19:49

I need to find the number, the in and out timecode points and all lines of the text.

9
00:09:48,347 --> 00:09:52,818
- Let\'s see... what else she\'s got?
-          


        
5条回答
  •  执念已碎
    2021-01-26 20:23

    I would personally split the lines into an array and loop through the array examining each line, just doing a regex match for the StartTime->EndTime lines, then you can use some fairly simple logic to grab Order from the previous line, and grab the text from lines following(by searching ahead to find the next StartTime->Endtime and backtracking two lines).

    I think this way chops the problem up a little so that you don't have a regex expression trying to do it all.

提交回复
热议问题