This task supports a nested FileSet element.
This task supports a nested Regexp element to specify the regular expression. You can use this element to refer to a previously defined regular expression datatype instance.
<regexp id="id" pattern="expression"/> <regexp refid="id"/>This task supports a nested Substitution element to specify the substitution pattern. You can use this element to refer to a previously defined substitution pattern datatype instance.
<substitution id="id" pattern="expression"/> <substitution refid="id"/>
Examples
<replaceregexp byline="true"> <regexp pattern="OldProperty=(.*)"/> <substitution expression="NewProperty=\1"/> <fileset dir="."> <includes="*.properties"/> </fileset> </replaceregexp>replaces occurrences of the property name "OldProperty" with "NewProperty" in a properties file, preserving the existing value, in all files ending in .properties in the current directory
<replaceregexp match="\s+" replace=" " flags="g" byline="true"> <fileset dir="${html.dir}" includes="**/*.html" /> </replaceregexp>replaces all whitespaces (blanks, tabs, etc) by one blank remaining the line separator. So with input
<html> <body> <<TAB>><h1> T E S T </h1> <<TAB>> <<TAB>> </body></html>would converted to
<html> <body> <h1> T E S T </h1> </body></html>