ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Antoine Levy-Lambert <anto...@gmx.de>
Subject Re: Using ReplaceRegExp
Date Tue, 21 Dec 2004 22:37:35 GMT
Hello Matt,

I do not know how to solve your problem, but you might have a look at 
filterchains.
Since filterchains get written into buildfiles as a tag containing n 
nested filter readers,
you can also write your own filter reader.
You can read the section about filter readers under "Custom Components" 
in the index of Concepts and Types
(on the web under 
http://ant.apache.org/manual/CoreTypes/custom-programming.html#filterreaders 
).
What I wonder is whether you can even define a custom filter reader on 
the fly in a build file using JavaScript (not sure, might be possible 
only for tasks ???).
Cheers,
Antoine

Matt Harp wrote:

>I'm using ReplaceRegExp to do some file mods and it's just too cool,
>except I can't figure out to have it re-evaluate a line in a file after
>it's already been evaluated.
>
>For example...
>
>I have a line in my file like this.
>
>	symbol Fred%20Barney%20Wilma%20;
>
>So, I want to replace the %20 string with a space, but only in the
>instance where the line starts with "symbol"
>
>I have this...
>
>      <replaceregexp flags="m" byline="false">
>         <regexp pattern="(^symbol.*?)%20(.*?)"/>
>         <substitution expression="\1 \2"/>
>         <fileset ...>
>		...
>         </fileset>
>      </replaceregexp>
>
>
>But the problem is that this only replaces the first found occurrence,
>which would turn the above line into
>
>	symbol Fred Barney%20Wilma%20;
>
>Using flags=g doesn't seem to help me, nor does any other combination I
>tried. I could add a for loop and just run this task a bunch of times,
>but there is no theoretical limit to how many %20's can be in this line,
>and I hate to loop 5000 times (for example) when the the most %20's in
>any file is 45.
>
>Any ideas?
>
>Thanks,
>
>-matt
>mharp@seapine.com
>
> 
>
>  
>



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


Mime
View raw message