Notepad++ - 在保持内容完整的情况下查找并替换开始和结束标签?
Notepad++ - Find and replace both opening and closing tags while keeping the content intact?
假设我想替换这样的东西:
\section{Introduction}
有了这个:
<h1>Introduction</h1>
在记事本++中。
基本上,找到并用不同的开始和结束标签替换所有开始标签(在本例中为“\section{”部分)和结束标签(“}”),
像这样。当然,除了标签之间的文本保持不变。这在记事本++中可能吗?
搜索:
\section\{(.*)\}
并替换为:
<h1></h1>
</code> 将替换为您的第一个正则表达式结果。</p>
<p><strong>即搜索:</strong></p>
<pre><code>\{(.*), (.*)\}
并替换为:
[, ]
将{foo, bar}
转换为[foo, bar]
:
</code> = foo
<code>
= 栏
查找内容:\section\{(.+)\}
替换为:<h1></h1>
这里括号(.+)
定义了一个由一个或多个字符组成的组,
引用了组的内容。
假设我想替换这样的东西:
\section{Introduction}
有了这个:
<h1>Introduction</h1>
在记事本++中。
基本上,找到并用不同的开始和结束标签替换所有开始标签(在本例中为“\section{”部分)和结束标签(“}”),
像这样。当然,除了标签之间的文本保持不变。这在记事本++中可能吗?
搜索:
\section\{(.*)\}
并替换为:
<h1></h1>
</code> 将替换为您的第一个正则表达式结果。</p>
<p><strong>即搜索:</strong></p>
<pre><code>\{(.*), (.*)\}
并替换为:
[, ]
将{foo, bar}
转换为[foo, bar]
:
</code> = foo
<code>
= 栏
查找内容:\section\{(.+)\}
替换为:<h1></h1>
这里括号(.+)
定义了一个由一个或多个字符组成的组,引用了组的内容。