Regex 如何在Ant中使用正则表达式替换xml标记之间的值?
我尝试使用Ant替换xml中的值 我的xml文件:Regex 如何在Ant中使用正则表达式替换xml标记之间的值?,regex,xml,ant,Regex,Xml,Ant,我尝试使用Ant替换xml中的值 我的xml文件: <session-config> <session-timeout>60</session-timeout> </session-config> 但在执行后从ant获得致命错误: [Fatal Error] The value of attribute "match" associated with an element type "replaceregexp" must not co
<session-config>
<session-timeout>60</session-timeout>
</session-config>
但在执行后从ant获得致命错误:
[Fatal Error] The value of attribute "match" associated with an element type "replaceregexp"
must not contain the '<' character.
[致命错误]与元素类型“replaceregexp”关联的属性“match”的值
不得包含“
字符必须分别使用
和
进行“转义”:
<replaceregexp file="WEB-INF/web.xml"
byline="true"
match="((?<=session-timeout\>)[\S\s]*?(?=\<\/session-timeout))"
replace='20'/>
<replaceregexp file="WEB-INF/web.xml"
byline="true"
match="((?<=session-timeout\>)[\S\s]*?(?=\<\/session-timeout))"
replace='20'/>