【问题标题】:Replace text with regexp in sublime text在崇高的文本中用正则表达式替换文本
【发布时间】:2014-09-07 20:51:09
【问题描述】:

如何用 sublime text 中的部分旧文本替换文本。

我有:

<span class="foo">some text</span>
<span class="foo">another text</span>

我想要:

<b>some text</b>
<b>another text</b>

搜索

<span class="foo">(\w+)</span> 

并替换为

{1} 

不工作

【问题讨论】:

    标签: regex sublimetext2 sublimetext3 text-processing


    【解决方案1】:

    搜索:&lt;span class="foo"&gt;(.*?)&lt;/span&gt;

    替换:&lt;b&gt;$1&lt;/b&gt;

    【讨论】:

    • 谢谢。我弄错了替换参数。
    【解决方案2】:

    使用 $1 而不是 {1} 替换文本

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-10-31
      • 1970-01-01
      • 2013-07-11
      • 2016-01-12
      • 1970-01-01
      • 2017-10-22
      相关资源
      最近更新 更多