map-query-replace-regexp
map-query-replace-regexp is an interactive compiled Lisp function in `replace.el
'.
(map-query-replace-regexp REGEXP TO-STRINGS &optional N START END)
Replace some matches for REGEXP with various strings, in rotation.
The second argument TO-STRINGS contains the replacement strings, separated
by spaces. This command works like `query-replace-regexp' except that
each successive replacement uses the next successive replacement string,
wrapping around from the last such string to the first.
In Transient Mark mode, if the mark is active, operate on the contents
of the region. Otherwise, operate from point to the end of the buffer.
Non-interactively, TO-STRINGS may be a list of replacement strings.
Interactively, reads the regexp using `read-regexp'.
Use M-n to pull the last incremental search regexp to the minibuffer
that reads REGEXP.
A prefix argument N says to use each replacement string N times
before rotating to the next.
Fourth and fifth arg START and END specify the region to operate on.