Bug 56845

Summary: Enhancement to ReplaceRegExp - suppport mutliple nested regexp
Product: Ant Reporter: icoulter
Component: Core tasksAssignee: Ant Notifications List <notifications>
Status: NEW ---    
Severity: enhancement    
Priority: P2    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: All   

Description icoulter 2014-08-13 09:51:18 UTC
Could the regexp task be extended to support multiple regexp and substitution 

For example something like this:

<replaceregexp file="test.txt">
  <regex>
     <regexp pattern="OldProperty=(.*)"/>
     <substitution expression="NewProperty=\1"/>
  </regex>
  <regex>
     <regexp pattern="UserName=Fred"/>
     <substitution expression="UserName=Joe"/>
  </regex>
</replaceregexp>


Main reason for this is due to Bug 34633.  Have seen scenario where I call replaceregexp  on same file multiple times, the first replace works but randomly the subsequent calls fail. Doing all the regexp in one task with one final file move from temp folder back to original might solve this?