I have the code:
import re sequence=\"aabbaa\" rexp=re.compile(\"(aa|bb)+\") rexp.findall(sequence)
This returns [\'aa\']
[\'aa\']
I do not understand why you use + - it means 0 or 1 occurrence, and is usually used when you want find string with optional inclusion of substring.
>>> re.findall(r'(aa|bb)', 'aabbaa') ['aa', 'bb', 'aa']
work as expected