File size: 760 Bytes
b17fe2a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import re

string = """
2024/12/11 06:10:03 speech starts at 4.45s
2024/12/11 06:10:03 speech ends at 4.96s
2024/12/11 06:10:03 speech starts at 9.63s
2024/12/11 06:10:03 speech ends at 9.92s
2024/12/11 06:10:03 speech starts at 20.58s
2024/12/11 06:10:03 speech ends at 21.02s
2024/12/11 06:10:03 speech starts at 27.36s
2024/12/11 06:10:03 speech ends at 27.61s
2024/12/11 06:10:03 speech starts at 27.97s
2024/12/11 06:10:03 speech ends at 31.20s
2024/12/11 06:10:03 speech starts at 31.55s
2024/12/11 06:10:03 speech ends at 33.21s
"""

pattern = ".*?speech starts at (.+?)s[\r\n].*?speech ends at (.+?)s"

result = re.findall(pattern, string, flags=re.DOTALL)
print(result)


if __name__ == "__main__":
    pass