New answers tagged

1

If LITERAL is nil then you can use "\\&" in the replacement to represent the entire matched string, and so your replacement text could be "PREFIX\\&". Refer to C-h f replace-match for the behaviour of LITERAL. (And if you didn't want special characters in the replacement text to be processed, you would generally want LITERAL to be ...


2

Is this for interactive use? I suppose so. As the doc string for replace-regexp says: This function is for interactive use only; in Lisp code use `re-search-forward' and `replace-match' instead. Are you really asking about replace-regexp, and not query-replace-regexp? Because if you use the latter then the answer is included in Isearch by default: ...


Top 50 recent answers are included