how to replace a match with multiple lines in emacs.
Example:- replacing "Dog" with barking animal
as shown below
The Dog
with
The Barking
animal
I tried \n in the command replace-regexp, for which emacs throws error saying Invalid use of `\' in replacement text
As documented in this article, the answer is to use C-qC-j to enter your newline if you're using M-x replace-string
So for you:
M-x replace-string
RET
Dog
RET Barking
C-qC-j animal
RET
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With