ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Matt Harp" <mh...@seapine.com>
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 ...>
		...
         </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

 

> -----Original Message-----
> From: Matt Harp [mailto:mharp@seapine.com] 
> Sent: Tuesday, December 21, 2004 1:05 PM
> To: user@ant.apache.org
> 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
> 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