Simple solution
<copy tofile="test.txt" file="file.txt"/>
<replaceregexp file="test.txt" match="12467abc" replace="34567abc"
byline="true"/>
<replaceregexp file="test.txt" match="12467def" replace="34567def"
byline="true"/>
<replaceregexp file="test.txt" match="12467xyz" replace="34567xyz"
byline="true"/>
<concat><fileset file="test.txt"/></concat>
Another possibility is using a template file and
<copy><filterchain><replacetokens>.
The simple solution is based on your "requirement"
> Replace:
> 12467abc => 34567abc
> 12467def => 34567def
> 12467xyz => 34567xyz
For heavy xml modifications you could use the external xml tasks
http://ant.apache.org/external.html#XmlTask
Jan
> -----Ursprüngliche Nachricht-----
> Von: Om Omkar [mailto:[email protected]]
> Gesendet: Mittwoch, 16. Oktober 2019 11:55
> An: [email protected]; [email protected]; [email protected]
> Betreff: Replacing value in an XML file using replaceregexp
>
> I want to replace three values from files(12467abc,12467def,12467xyz).
>
> <sample>IF( TEXT( $User.ABC_USR_Brand__c )="Maruti",
> "/servlet/servlet.FileDownload?file=12467abc",
> IF ( TEXT($User.ABC_USR_Brand__c )="Maruti Suzuki",
> "/servlet/servlet.FileDownload?file=12467def",
> "/servlet/servlet.FileDownload?file=12467xyz"))</sample>
>
> I want to replace below values in above lines using build.xml file.
>
> Replace:
>
> 12467abc => 34567abc
> 12467def => 34567def
> 12467xyz => 34567xyz
>
> I have made this query please suggest. I will use below query two times
> as there is two numbers to replace. <replaceregexp byline="false"
> match="
> (?=<group>12467abc)(.*)(?=<\/group>)" replace="
> <group>34567abc" flags="g"> <fileset dir="../src/store/"><include
> name="*.xml"/></fileset> </replaceregexp>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]