更新时间:2021-12-29 10:00:59
这个正则表达式应该符合你的要求:
This regex should match what you want:
(start((?!start).)*?end)
使用 re.findall
方法和单行修饰符 re.S
获取多行字符串中的所有出现:
Use re.findall
method and single-line modifier re.S
to get all the occurences in a multi-line string:
re.findall('(start((?!start).)*?end)', text, re.S)
在此处查看测试.