ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Matt Harp" <>
Subject Using ReplaceRegExp
Date Tue, 21 Dec 2004 20:38:53 GMT
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 ...>

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?




> -----Original Message-----
> From: Matt Harp [] 
> Sent: Tuesday, December 21, 2004 1:05 PM
> To:
> Subject: Moving files based on relative directory?
> I'm trying to take files and just move them up one directory 
> level from where they are.
> I've been surfing the list archives and can't seem to find 
> anything on this.
> Any help would be much appreciated,
> -matt

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

View raw message