I\'m parsing strings that could have any number of quoted strings inside them (I\'m parsing code, and trying to avoid PLY). I want to find out if a substring is quoted, and
This should solve your issue pattern=r"(?=(\"[^\"]+\"|'[^']+'))"
Then use the following to get all overlapping indices,
indicesTuple=[(mObj.start(1),mObj.end(1)-1) for mObj in re.finditer(pattern,input)]