返回与python匹配的重复出现的正则表达式

返回与python匹配的重复出现的正则表达式,python,regex,Python,Regex,我有一个字符串: SomeTextSomeTextASomeThingBSomeTextSomeTextASomeThingElseBSomeText 我猜正则表达式都不正确,我也不知道如何访问匹配项。它是否与finditer或…?尝试使用re.findall: >>> print re.findall('A(.*?)B', s) ['SomeThing', 'SomeThingElse'] 在线查看它的工作情况: 注意问号。如果没有它,匹配将贪婪地完成-它将消耗尽可能多的字

我有一个字符串:

SomeTextSomeTextASomeThingBSomeTextSomeTextASomeThingElseBSomeText
我猜正则表达式都不正确,我也不知道如何访问匹配项。它是否与
finditer
或…?

尝试使用
re.findall

>>> print re.findall('A(.*?)B', s)
['SomeThing', 'SomeThingElse']
在线查看它的工作情况:

注意问号。如果没有它,匹配将贪婪地完成-它将消耗尽可能多的字符

>>> print re.findall('A(.*?)B', s)
['SomeThing', 'SomeThingElse']