@
Ctry Help on function findall in module re:
findall(pattern, string, flags=0)
Return a list of all non-overlapping matches in the string.
If one or more capturing groups are present in the pattern, return
a list of groups; this will be a list of tuples if the pattern
has more than one group.
Empty matches are included in the result.
结合我在#2 说的,如果想存粹地获取匹配的内容,可以
import re
text = 'ABCDE'
f2 = re.compile('(B|C|D)+')
print([m.group(0) for m in re.finditer(f2, text)])