ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan.Mate...@rzf.fin-nrw.de
Subject RE: Help with replacing string in a file using more then one matc hing token
Date Thu, 02 Oct 2003 06:11:13 GMT
If that is xml, choose XSLT or xml tasks.
If plain text evaluate the right regexp and use <replaceregexp> optional
task.

Some regexp-guessing:

<replaceregexp
  match="(.*\"Susie\".*lastName=\")Smith(\".*)"
  replace="\1Simpson\2"
  byline="true"
/>


Jan




> -----Original Message-----
> From: Juniarti Suryakusuma [mailto:juni_as@mail.utexas.edu]
> Sent: Wednesday, October 01, 2003 11:26 PM
> To: user@ant.apache.org
> Subject: 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
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message