ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Antoine Levy-Lambert <anto...@antbuild.com>
Subject AW: Help with replacing string in a file using more then one matching token
Date Thu, 02 Oct 2003 09:59:19 GMT
This should be possible using the replaceregexp task which is listed under
optional tasks
and exists in ant1.5.4 and 1.6beta (and maybe before, but I did not check
exactly).
match="(firstName=&quot;Susie&quot;.+lastName=&quot;)Smith&quot;"
replace="\1Simpson&quot;" should do it
Cheers,
Antoine

-----Ursprungliche Nachricht-----
Von: Juniarti Suryakusuma [mailto:juni_as@mail.utexas.edu]
Gesendet: Mittwoch, 1. Oktober 2003 23:26
An: user@ant.apache.org
Betreff: Help with replacing string in a file using more then one
matching token


Hi,
Can anyone help me on please?
I am trying to replace a string in a file, such as text.xml

And inside text.xml there are strings like this below:
firstName="Jamie"  middleName="A"  id="4242522"  lastName="Smith"
firstName="Susie"  middleName="M"  id="5223242"  lastName="Smith"

I need to change the last name of Susie to from Smith  to  Simpson.
So basically I need to match Susie and Smith and replace Smith with
Simpson if the firstName is Susie.
Thanks.



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message