ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nicolas Vervelle <nicolas.verve...@steria.com>
Subject Re: replaceregexp on multiple lines
Date Tue, 29 Mar 2005 06:43:12 GMT
Ok,

thanks for the answer,
in fact, I have modified the file for not having new lines any more.
But I will remember the difference between '*' and '*?', that could be 
useful :)

Nicolas

David Resnick wrote:

>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:
>http://java.sun.com/j2se/1.4.2/docs/api/java/util/regex/Pattern.html).
>
>The quantifier you used, '*', is characterized as a greedy quantifier. Try
>'*?' (reluctant quantifier). 
>
>HTH, David
>
>-----Original Message-----
>From: Nicolas Vervelle [mailto:nicolas.vervelle@steria.com] 
>Sent: Thursday, March 24, 2005 23:36
>To: user@ant.apache.org
>Subject: replaceregexp on multiple lines
>
>Hi,
>
>I have a file containing several times something like (xx is 
>different) :
><language lang="xx">
><a>...</a>
></language>
>
>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 :
><replaceregexp
>  match='<language lang="@{current.language}">(.*)
></language>'
>  replace='\1' flags='gm'>
>  <fileset dir="@{current.dir}" includes="index.*.html"/>
></replaceregexp>
>
>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 ?
>
>TIA,
>Nicolas
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>For additional commands, e-mail: user-help@ant.apache.org
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>For additional commands, e-mail: user-help@ant.apache.org
>
>
>  
>


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


Mime
View raw message