This requires the use of the <replaceregexp> tag in the build file, which is probably the way it is used:
1 < file= "${src}/build.properties"2 match= "oldproperty= (. *)" 3 replace= "Newproperty=\1"4 byline= " True "5/>
Note that Ant does not recognize this tag by default, and in order to use this tag, it needs to include a predefined definition in the build file:
1 <TaskdefResource= "Net/sf/antcontrib/antcontrib.properties">2 <Classpath>3 <pathelement Location= "${ant.home}/exlib/ant-contrib-1.0b3.jar" />4 </Classpath>5 </Taskdef>
You need to use the Ant-contrib-1.0b3.jar file here, please check your ant installation directory There is no this file in addition, it should be noted that the regular expression is written in the XML, it is also necessary to escape, this refer to the syntax of XML
Replacing file contents with regular expressions in an ant build file