In my latex file, I defined
\newcommand{\replace}[2]{\textcolor{red}{\sout{#1} }\textcolor{blue}{{#2}}}
Just to highlight changes. So in my paper draft, there are many occurrences of
\replace{old text}{new text}
Now the paper is accepted, and I want to get a clean version. How can I use emacs Regex replacement to change all of them to
new text
A very simple way to do this is to modify your replace command so that it only prints the new text:
Otherwise, I would do this with a keyboard macro such as the following:
The logic behind this keyboard macro is that you search for
\replace{commands, then useforward-sexpandbackward-sexpto move around balanced pairs of `curly brackets.Edit: note that the binding for
forward-sexpis traditionally written as C-M-<right>, but such a key press might be intercepted by your window manager (a very frequent behaviour for Linux boxes at least). It is therefore often easier to type ESCC-<right> instead.