This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
M-x replace-regexp <RET> | |
\(dog\)\|cat <RET> | |
\,(if \1 "cat" "dog") <RET> | |
Beginning Line 3 with `\,` tells Emacs that this line should be evaluated as a Lisp expression. | |
The `\1` on Line three referres to the first grouped of characters defined with `(` and `)` on line 2. | |
Read line 3 as if `\1` replace with "cat" else replace with "dog" | |
You have to escape (i.e. preceed with `\`) the `(`, `)` and `|` characters for them to be treated as special characters |
NewerOlder