在ANT中,replacefilter令牌可以是通配符吗?

时间:2015-12-02 20:48:27

标签: regex ant

喜欢在:

 <replace file="${src}/index.html" token="&lt;/copyright>beginning text*end text&lt;copyright>" value="wombat"/>

其中&#34;&lt; / copyright&gt;开头文字*结束文字&lt; copyright&gt;&#34;是某种字符串,我不知道它的中间内容。

我有一种情况,我不能100%确定我想要替换的文本每次都是相同的。

1 个答案:

答案 0 :(得分:2)

如果要匹配模式,请使用replaceregexp任务。请参阅https://ant.apache.org/manual/Tasks/replaceregexp.html

它具有几乎相同的用法语法,但接受正则表达式作为匹配字符串。