How can I do the equivalent of
query-replace-regexp for multiple regexps?
For instance, if regexp1 is matched, it should be replaced by text1, and if regexp2 is matched, it should be replaced by text2 (with interactive confirmation as with
query-replace-regexp). The search and replace needs to be done in one pass for all the regexps (I don't want to use
query-replace-regexp on the first regexp, then on the second regexp, and so on).
While querying could be done with a single regexp like
regexp1\|regexp2, I don't know how I could do the replacement depending on whether regexp1 or regexp2 is matched. When
query-replace-regexp is called interactively,
\, can be used to execute a Lisp expression, which could do the selection, but this is not possible for code put in my
.emacs, for instance.