像这样的作品:
## pattern: Upercase, then anything that is not in (.!?), then one of them>>> pat = re.compile(r'([A-Z][^.!?]*[.!?])', re.M)>>> pat.findall('OMG is this a question ! Is this a sentence ? My. name is.')['OMG is this a question !', 'Is this a sentence ?', 'My.']请注意
name is.结果中不是怎么回事,因为它不是以大写字母开头。
您的问题来自
^$锚的使用,它们在整个文本上都有效。



