ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Resnick" <>
Subject RE: replaceregexp on multiple lines
Date Mon, 28 Mar 2005 06:03:33 GMT
You need to look into the documentation of the regexp package you have Ant
setup to use (the default is java.util.regex in JDK 1.4; you can find docs
for it here:

The quantifier you used, '*', is characterized as a greedy quantifier. Try
'*?' (reluctant quantifier). 

HTH, David

-----Original Message-----
From: Nicolas Vervelle [] 
Sent: Thursday, March 24, 2005 23:36
Subject: replaceregexp on multiple lines


I have a file containing several times something like (xx is 
different) :
<language lang="xx">

For some of them (depending on "xx"), I want to keep only the 
<a>...<.a> part.
For the others, I wan to completely remove them.
I tried this :
  match='<language lang="@{current.language}">(.*)
  replace='\1' flags='gm'>
  <fileset dir="@{current.dir}" includes="index.*.html"/>

but the problem if pattern is first matched with the text between the 
first <language lang="xx"> of the file and the last </language> and not 
closest one.
Is there an other way to replace the text ?


To unsubscribe, e-mail:
For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message