简体   繁体   English

如何在emacs中用多行替换搜索?

[英]how to replace a search with multiple lines in emacs?

how to replace a match with multiple lines in emacs. 如何在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 我在命令replace-regexp中尝试了\\ n,emacs会抛出错误,说明在替换文本中无效使用`\\'

As documented in this article , the answer is to use Cq Cj to enter your newline if you're using Mx replace-string 本文所述,答案是如果您使用Mx replace-string ,则使用Cq Cj输入换行符

So for you: 所以对你来说:

Mx replace-string RET Dog RET Barking Cq Cj animal RET Mx replace-string RET Dog RET Barking Cq Cj animal RET

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM