regex - Ant ReplaceRegExp task - multiple substitutions per file? -


i'm using ant replaceregexp task replace text in on 10,000 files. each file has multiple search/replace patterns need perform. of right now, have multiple blocks, each fileset of "**/*.java".

as list of things search/replace grows, takes forever run since replaceregexp #1 on 10k files, replaceregexp2 on 10k files, , on. have 15 replaceregexp blocks, task taking 45 minutes.

is there way each file processed/accessed once, , performs 15+ of regex search/replaces on file rather file having processed 15+ individual times?

in essence, looking logically this:

    <replaceregexp           match="firstmatch"           replace="firstraplce"          match="secondmatch"         replace="secondreplace"          etc..          byline="true">         <fileset dir=".">             <include name="**/*.java"/>         </fileset>     </replaceregexp> 

that's invalid xml, shows conceptually i'm looking for. use 2 groups - 1 "firstmatch/firstreplace" , 1 "secondmatch/secondreplace" on same set of files.

thanks.

the following works:

 <filterchain>     <tokenfilter>         <replacestring from="oldstr1" to="newstr1"/>         <replacestring from="oldstr2" to="newstr2"/>     </tokenfilter>  </filterchain> 

Comments