Ant task to find and replace in property value -
ant task "replace" find-and-replace in contents of file. can used (or there other task) work directly on property value.
e.g. want find ampersand property value , replace other string. achieve in multiple steps.
<property name="prop_before" value="abc&pqr" /> <echo file="propfile" message="${prop_before}" /> <replace file="propfile" token="&" value="esacape_and" /> <loadfile property="prop_after" srcfile="propfile"/>
is there ant task below ?
<replace source_property="prop_before" destination_property="prop_after" token="&" value="esacape_and" />
if can add external libraries, it's simplest use propertyregex ant-contrib project:
<propertyregex property="pack.name" input="package.abc.name" regexp="(package)\.[^\.]*\.(name)" replace="\1.def.\2" casesensitive="false" />
Comments
Post a Comment