>>> match = re.findall(r\'\\w\\w\', \'hello\') >>> print match [\'he\', \'ll\']
Since \\w\\w means two characters, \'he\' and \'l
You can use the new Python regex module, which supports overlapping matches.
>>> import regex as re >>> match = re.findall(r'\w\w', 'hello', overlapped=True) >>> print match ['he', 'el', 'll', 'lo']