Fixes #5382: Correct a bug introduced in #5381 (missing escapes in regular expression substitution)