The Python re module uses '\n' for group backreference substitution,
whereas mod_alias uses '$n', and thus we must translate between them
when processing RedirectMatch directives. Previously this was done by
substituting backslashes for any dollar signs in the replacement string.
However, group substitution only occurs when the $ is not escaped with a
backslash and is followed by a decimal digit. Follow the same rules
here.
Change-Id: Ib33534b40e0b126c769ec17f76e1ecc83d790ebc