ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Scot P. Floess" <>
Subject Re: Advanced Regexp Question
Date Sun, 08 Jan 2012 16:08:55 GMT

I could be wrong, but my guess is he wants this first pass (I suppose 
because that's what I'd want)...

The only problem with twice doesn't address what happens if there 
is a third, fourth and fifth (and so on) references...

On Sun, 8 Jan 2012, Andy Stevens wrote:

> On 6 Jan 2012 21:12, <> wrote:
>> Say I have a string in a file like this:
>>        require(["a","foo/b","foo/c"], function(){...})
>> What I want to do is replace all the "foo" with "bar" so the final product
>> looks like this:
>>        require(["a","bar/b","bar/c"], function(){...})
>> With replaceregexp the best I've been able to get was below using regexp
>> like "require\(\s*\[(.*)foo/([^\]]*)\]"
>>        require(["a","foo/b","bar/c"], function(){...})
>> (I can't just do a global replace on "foo" because I only want to do the
>> replacement in this "require" context.)
>> Any ideas?
> Run your regexp over the file twice? Second pass will catch the foo that
> was left over the first time.
> Andy.

Scot P. Floess             RHCT  (Certificate Number 605010084735240)
Chief Architect FlossWare

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

View raw message