ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Greg.Zol...@aviall.com
Subject Advanced Regexp Question
Date Fri, 06 Jan 2012 21:11:34 GMT
Hello,

I am able to do some very simple regexp replacement with the replaceregexp 
ant task but now need to do something a little more advanced.

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?

Thanks for any advice,
Greg

"If I had asked my customers what they wanted, they would have said 'A 
faster horse'" -- Henry Ford

_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
_

This e-mail message, including attachments, may contain confidential, 
proprietary, or export controlled information.
Any unauthorized disclosure, distribution, or other use is prohibited, 
unless expressly authorized. 
If you receive this e-mail in error, please notify the sender, and delete 
all copies of the original message from your systems.
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message