在Python中,我正在搜索两个词之间的字符串,即Introduction
和Theory Development
:
string = "Introduction: What is game Game Theory ? Theory Development. Introduction: What is game Game Theory ? Probably real content is here. Theory Development."
在这种情况下,我想获得第二个。总的来说,在所有比赛中,我想得到最长的一场。我该怎么办?
我目前正在这样做:
import re
regex = 'Introduction(.+?)Theory Development'
match = re.search(regex, string, flags=re.IGNORECASE)
rawText = match.group(1)