Is there a way that I can find out how many matches of a regex are in a string in Python? For example, if I have the string \"It actually happened when it acted out of
\"It actually happened when it acted out of
import re print len(re.findall(r'ab',u'ababababa'))