Return-Path: X-Original-To: apmail-ant-user-archive@www.apache.org Delivered-To: apmail-ant-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 1F3FDBA9A for ; Sun, 8 Jan 2012 16:09:24 +0000 (UTC) Received: (qmail 31721 invoked by uid 500); 8 Jan 2012 16:09:23 -0000 Delivered-To: apmail-ant-user-archive@ant.apache.org Received: (qmail 31350 invoked by uid 500); 8 Jan 2012 16:09:21 -0000 Mailing-List: contact user-help@ant.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Ant Users List" Reply-To: "Ant Users List" Delivered-To: mailing list user@ant.apache.org Received: (qmail 31342 invoked by uid 99); 8 Jan 2012 16:09:21 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 08 Jan 2012 16:09:21 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of sfloess@nc.rr.com designates 75.180.132.120 as permitted sender) Received: from [75.180.132.120] (HELO cdptpa-omtalb.mail.rr.com) (75.180.132.120) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 08 Jan 2012 16:09:15 +0000 X-Authority-Analysis: v=2.0 cv=JJy5Qr2b c=1 sm=0 a=gykjJZTUHnAhHSXPG7EaJg==:17 a=8MN4lfJQaL4A:10 a=kj9zAlcOel0A:10 a=RCtI8ZogAAAA:8 a=FP58Ms26AAAA:8 a=NEAV23lmAAAA:8 a=Fzj2JBTR_LLjrf7O91UA:9 a=CjuIK1q_8ugA:10 a=W4aLYrWHp6YA:10 a=wBpG7aQfatAO_te7:21 a=l-d4GPdvklvwFPVo:21 a=gykjJZTUHnAhHSXPG7EaJg==:117 X-Cloudmark-Score: 0 X-Originating-IP: 76.182.110.11 Received: from [76.182.110.11] ([76.182.110.11:42964] helo=flossware.homelinux.org) by cdptpa-oedge03.mail.rr.com (envelope-from ) (ecelerity 2.2.3.46 r()) with ESMTP id 4C/1A-18618-69FB90F4; Sun, 08 Jan 2012 16:08:54 +0000 Received: from centos-workstation.flossware.com (centos-workstation.flossware.com [192.168.167.251]) by flossware.homelinux.org (Postfix) with ESMTP id 426F8D00D58 for ; Sun, 8 Jan 2012 11:08:54 -0500 (EST) Date: Sun, 8 Jan 2012 11:08:55 -0500 (EST) From: "Scot P. Floess" X-X-Sender: sfloess@centos-workstation.flossware.com To: Ant Users List Subject: Re: Advanced Regexp Question In-Reply-To: Message-ID: References: User-Agent: Alpine 2.00 (LRH 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed 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 is...it 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 http://sourceforge.net/projects/flossware http://flossware.sourceforge.net https://github.com/organizations/FlossWare --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For additional commands, e-mail: user-help@ant.apache.org