With re.sub you can use named groups to refer them in the replacement string:
re.sub
import re re.sub(r"(?P.*):(.*)", r"