I would like to find all the occurrences of sub-strings in a text.
This works:
import re
[m.start() for m in re.finditer('te.t', 'text test taste test')]
it returns [0, 5, 13]
But these return only one match while I know there are more:
text = 'AAGCCAGATGAATGTTTTTTTTTTtcagggaagaagaaAAAAAACCAAACAAAAATAATGATCCTGACG'
[m.start() for m in re.finditer('TTTTTT..............AAAAAA', text.upper())]
# or even this one
[m.start() for m in re.finditer('TTTTTT', text.upper())]
Is this a flaw in the algorithm? It seems that it doesn't understand that a longer stretch of 'TTTTTTTTTT' involves many 'TTTTTT' matches.
Am I missing something?