You are using the escape sequence \1
instead of the backreference \1
.
You can fix this by changing to escaping the \
before 1
.
print display(re.match('r?(""")(.*?)\\1', data, re.S))
You can also fix it by using a raw string for your regex, with no escape sequences.
print display(re.match(r'r?(""")(.*?)\1', data, re.S))