The strings I want to match includes some escape sequences, like ‘It\’s something’. It’s no problem to match it with ‘.*?’, however the result is escaped automatically. How to prevent the automatic escaping, and keep the backslashes as they are?
For example:
>>> re.findall('\((?P<content>.*?)\)','(It\'s something)')
["It's something"]
And what I want is:
[r"It\'s something"]
There is no backslash in your input string.