This is a simple example:
import re
math='<m>3+5</m>'
print re.sub(r'<(.)>(\d+?)\+(\d+?)</\1>', int(r'\2') + int(r'\3'), math)
It gives me this error:
ValueError: invalid literal for int() with base 10: '\\2'
It sends \\2 instead of 3 and 5.
Why? How do I solve it?