]> git.eshelyaron.com Git - emacs.git/commitdiff
(Unconditional Replace): Explain how to replace two strings
authorRichard M. Stallman <rms@gnu.org>
Sun, 24 Nov 2002 19:07:46 +0000 (19:07 +0000)
committerRichard M. Stallman <rms@gnu.org>
Sun, 24 Nov 2002 19:07:46 +0000 (19:07 +0000)
each with the other.

man/search.texi

index ea2b461e276fea39716e51cf70ef04715c4cca9b..a9d5b5e9ba5262d0b3712bebf2e3632df71f8e04 100644 (file)
@@ -845,6 +845,18 @@ C-@key{SPC}} to move back there.
   A numeric argument restricts replacement to matches that are surrounded
 by word boundaries.  The argument's value doesn't matter.
 
+  What if you want to exchange @samp{x} and @samp{y}: replace every @samp{x} with a @samp{y} and vice versa?  You can do it this way:
+
+@example
+M-x query-replace @key{RET} x @key{RET} @@TEMP@@ @key{RET}
+M-x query-replace @key{RET} y @key{RET} x @key{RET}
+M-x query-replace @key{RET} @@TEMP@@ @key{RET} y @key{RET}
+@end example
+
+@noindent
+This works provided the string @samp{@@TEMP@@} does not appear
+in your text.
+
 @node Regexp Replace, Replacement and Case, Unconditional Replace, Replace
 @subsection Regexp Replacement