match-substitute-replacement

match-substitute-replacement is a compiled Lisp function in `subr.el'.

(match-substitute-replacement REPLACEMENT &optional FIXEDCASE LITERAL STRING SUBEXP)

Return REPLACEMENT as it will be inserted by `replace-match'.
In other words, all back-references in the form `\&' and `\N'
are substituted with actual strings matched by the last search.
Optional FIXEDCASE, LITERAL, STRING and SUBEXP have the same
meaning as for `replace-match'.