ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From denisbou...@free.fr
Subject Re: Ant replaceregexp match="$" replace="\n\$" erroneous behaviour ?
Date Thu, 25 Mar 2004 08:40:46 GMT
As I cannot replace so easyly the ant version I've workaround this problem by
using : 

<replace file="installTurlututuEarWASReadable.jacl" token="$"
value="${line.separator}$"/>

C U,
Denis;

Selon Stefan Bodewig <bodewig@apache.org>:

> On Wed, 24 Mar 2004, Matt Benson <gudnabrsam@yahoo.com> wrote:
> > --- denisboutin@free.fr wrote:
> >>  <replaceregexp
> >> file="installTurlututuEarWASReadable.jacl"
> >> match="\$"
> >> replace="\n\$" flags="g"/>
> >> 
> >> However, I've got the following exception :
> >> BUILD FAILED
> >> java.lang.StringIndexOutOfBoundsException: String
> >> index out of range: 2
> > 
> > Looks like a bug in Ant regarding the oobe...
> 
> Yes, but an old one, since Denis is using Ant 1.5.  There was a bug in
> the code that tries to expand properties when the String ended in an
> $.
> 
> > however, the proper way to escape a '$' is to double it.  '\$' is
> > incorrect.
> 
> Not really, Denis needs both escapes in Ant 1.5 and probably only one
> $ in Ant 1.6.x (or 1.5.4 for that matter).
> 
> The \ is needed to escape the $ for the regexp engine since it is a
> special character for regexps.  For Ant 1.5 you'd need \$$ and for
> more a recent version of Ant \$ should be enough.
> 
> Stefan
> -- 
> http://stefanbodewig.blogger.de/
> 
> ---------------------------------------------------------------------
> 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