我需要替换html页面中的字符串。 但我无法让我的正则表达式找到字符串。
我有这一行:
< span class =“foobar”>随机文字< / span>
我想改为:
< span class =“foobar”>新文字< / span>
我尝试过这个例子的各种变种而没有匹配。
<replace file="${install.path}\app_data\Header.htm">
<replacefilter token="foobar">.*" value="foobar"> New text </span>" />
</replace>
我错过了什么?当我在正则表达式工具中测试正则表达式时看起来很好。
答案 0 :(得分:0)
正如我发布的那样,我找到了答案:
<replaceregexp match="foobar">(.*)<" replace=foobar"> New text <">
<fileset dir="${install.path}\app_data" includes="Header.htm"/>
</replaceregexp>