Ant中的Regexp没有找到任何东西

时间:2013-06-14 09:04:01

标签: ant

我需要替换html页面中的字符串。 但我无法让我的正则表达式找到字符串。

我有这一行:

< span class =“foobar”>随机文字< / span>

我想改为:

< span class =“foobar”>新文字< / span>

我尝试过这个例子的各种变种而没有匹配。

<replace file="${install.path}\app_data\Header.htm">
      <replacefilter token="foobar&quot;&gt;.*" value="foobar&quot;&gt; New text &lt;/span&gt;" />
</replace>

我错过了什么?当我在正则表达式工具中测试正则表达式时看起来很好。

1 个答案:

答案 0 :(得分:0)

正如我发布的那样,我找到了答案:

<replaceregexp match="foobar&quot;&gt;(.*)&lt;" replace=foobar&quot;&gt; New text &lt;">
    <fileset dir="${install.path}\app_data" includes="Header.htm"/>
</replaceregexp>