I am trying to match all instances of the pattern in the string using Python. However, when the patterns overlap I get only the longest one, while I need both:
import re
st = '''GYMGMTPRLGLESLLEStopAS'''
w = re.findall("M\w*?(?=Stop)",st)
print w
Output:
1. MGMTPRLGLESLLE
Desired output:
1. MGMTPRLGLESLLE
2. MTPRLGLESLLE