re.sub(r'.\d+.',r'.','ab.12.c')
#or
re.sub(r'\.\d+\.',r'.','ab.12.c')
give ab.c, while
re.sub(r'.\d+.',r'\.','ab.12.c')
#or
re.sub(r'\.\d+\.',r'\.','ab.12.c')
give ab\\.c.
The former gives the result I want but shouldn't . be escaped in the regex, as in the latter?