How to replace value between xml tags using regex in Ant?



I'm trying to use Ant for replacing value in xml.


My xml file:



<session-config>
<session-timeout>60</session-timeout>
</session-config>


I want to replace 60 to 20


And use for this following regexp in ant task replaceregexp:



(?<=session-timeout>)[\S\s]*?(?=</session-timeout)


<target name="step1">
<replaceregexp file="WEB-INF/web.xml"
byline="true"
match="((?<=session-timeout\>)[\S\s]*?(?=\<\/session-timeout))"
replace='20'/>
</target>


But got fatal error from ant after execution:



[Fatal Error] The value of attribute "match" associated with an element type "replaceregexp"
must not contain the '<' character.


Please advise, how to change my regexp, or maybe there is an another solution of this problem? Thanks.


No comments:

Post a Comment