Regex back-reference in Python

\1, \2, and so on

\0 does not mean the whole capture, instead it denotes the null character.

Back-references can be used inside the pattern and also inside the replacement.