I am trying to match more than 2 occurrences of haha
in the following code. But ()
seems to be working as grouping. Why isn't it working?
>>> pattern="this is a joke hahahahahaaa. I cannot stop laughing hahahaaa"
>>> print(re.findall("(ha){2,}",pattern))
['ha', 'ha']
I wanted results to be:
['hahahaha', 'hahaha']
How do I fix it?