Function: match-substitute-replacement
match-substitute-replacement is a byte-compiled function defined in
subr.el.gz.
Signature
(match-substitute-replacement REPLACEMENT &optional FIXEDCASE LITERAL STRING SUBEXP)
Documentation
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.
Other relevant functions are documented in the regexp group.
Probably introduced at or before Emacs version 23.1.
Shortdoc
;; regexp
(match-substitute-replacement "new")
e.g. => "new"
Source Code
;; Defined in /usr/src/emacs/lisp/subr.el.gz
(defun 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'."
(declare (side-effect-free t))
(let ((match (match-string 0 string)))
(save-match-data
(match-data--translate (- (match-beginning 0)))
(replace-match replacement fixedcase literal match subexp))))