Return-Path: Delivered-To: apmail-ant-user-archive@ant.apache.org Received: (qmail 85365 invoked by uid 500); 26 Jun 2003 17:52:19 -0000 Mailing-List: contact user-help@ant.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Ant Users List" Reply-To: "Ant Users List" Delivered-To: mailing list user@ant.apache.org Received: (qmail 85220 invoked from network); 26 Jun 2003 17:52:18 -0000 Received: from unknown (HELO corvil.com) (213.94.219.177) by daedalus.apache.org with SMTP; 26 Jun 2003 17:52:18 -0000 Received: from preilly.local.corvil.com (preilly.local.corvil.com [172.18.1.173]) by corvil.com (8.12.9/8.12.5) with ESMTP id h5QHqKlT023507 for ; Thu, 26 Jun 2003 18:52:21 +0100 (IST) (envelope-from peter.reilly@corvil.com) Subject: RE: replaceregexp help From: peter reilly To: Ant Users List In-Reply-To: References: Content-Type: text/plain Organization: Message-Id: <1056650225.5054.180.camel@preilly.local.corvil.com> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.2 (1.2.2-4) Date: 26 Jun 2003 18:57:05 +0100 Content-Transfer-Encoding: 7bit X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N No, the single quotes are treated as normal characters. Peter On Thu, 2003-06-26 at 17:35, Faist, Jeff wrote: > Can you use single quotes ' ' so it does not get processed like in Korn > shell scripts? > > JEff > -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- > Jeffrey W. Faist > Configuration Management Analyst > Encoda Systems, Inc. > 1999 Broadway, Suite 4000 > Denver, Colorado 80202-3050 USA > jeff.faist@encodasystems.com > Direct Phone Line: +1 (303) 390 8496 > Fax Line: +1 (303) 390 8425 > > > -----Original Message----- > From: peter reilly [mailto:peter.reilly@corvil.com] > Sent: Thursday, June 26, 2003 2:10 AM > To: Ant Users List > Subject: RE: replaceregexp help > > > The problem is the \'s as there are special characters in > the replace string (\1 \2 ... etc) and they need to > be escaped many times. > one can do: > > > file="change.properties" > match=".:[\\]+blah" > replace="d:\\\\\\\\\localblah" > byline="true" > flags="i"/> > > but the following may be better: > file="change.properties" > match="(.:)([\\]+)blah" > replace="d:\2localblah" > byline="true" > flags="i"/> > > peter. > > On Thu, 2003-06-26 at 00:39, Michael Finger wrote: > > David, > > Thanks for the response, glad to know it's just not my rusty regexp > skills.... > > It turns out using match".:(\\*)blah" works, > > I was trying it before I put in the 'i' flag... > > I'm still having problems with the replace c:\\\\ though, but there are > some bugs and patches in ant bugzilla, so I'll try those. > > What wierd is I got replace c:\\\\blah to go to --> c:\blah on the write, > > but when I use a property, match="${prop} where prop=c:\\\\\\\\blah > > I just get c:blah..... > > In the first case I figure ant is preprocessing and then the regexp is > getting processed.... > > In the case with properties, who knows..... > > > > Mike > > > > > > -----Original Message----- > > From: Harkness, David [mailto:DHarkness@sonypictures.com] > > Sent: Wed 6/25/2003 4:03 PM > > To: Ant Users List > > Cc: > > Subject: RE: replaceregexp help > > > > > > > > Assuming the replaceregexp task uses mostly regular expressions (I > > haven't used it, but I'm fairly fluent with regexps), what's > happening > > is that \ is escaping the next character (so if you wanted to match > a > > real asterisk, you'd do "\*"). Try these: > > > > Match=".:\\\\?blah" > > > > Each \\ becomes a single literal \ and ? means zero or one of the > > previous character/group. So that matches \ and \\ but not \\\. > > > > What's odd is that ".:(\\*)blah" should have matched c:\blah and > > c:\\blah (and c:\\\\\\blah). It's possible that the regexps that > task is > > using doesn't have grouping with ()s. In any case, grouping isn't > needed > > here as you're modifying a single character (\\ becomes a single \). > > > > Now for replacing, you need the same escaping: > > > > replace="d:\\\\localblah" > > > > Again, it's odd that you're getting "d:localblah" as you should have > > gotten "d:\localblah". It's as if the escape substitution is > happening > > twice > > > > "d:\\localblah" --> "d:\localblah" --> "d:localblah" > > > > as "\l" will be substituted with "l". If the above doesn't work, see > if > > it is doing substitution twice by double all of the "\"s. :) That > would > > be odd, however. > > > > Good luck! > > Dave > > > > David Harkness > > Sony Pictures Digital Networks > > > > -----Original Message----- > > From: Michael Finger [mailto:mfinger@SVTECHNOLOGY.com] > > Sent: Wednesday, June 25, 2003 3:44 PM > > To: Ant Users List > > Subject: replaceregexp help > > > > > > Hello, > > > > I'm struggling a bit with the replaceregexp task. I have a property > file > > and > > > > want to replace "c:\\blah" in the line > > "myproperty=c:\\blah\\yadaa\\yack" with > > > > "d:\\localblah" ... > > > > Here's what i'm doing: > > > > file="${veritySearchDir}/config/verityindexer.properties" > > > > match=".:..blah" > > > > replace="d:\\localblah" > > > > byline="true" > > > > flags="i"/> > > > > > > > > but I'm getting: > > > > myproperty=d:localblah\\yadaa\\yack in the file... > > > > and I want myproperty=d:\localblah\\yadaa\\yack in the file... > > > > I've also tried using @#x5c;... > > > > Also, on the match part it would be nice to match c:\\blah and > c:\blah. > > I've tried match= ".:(\\*)blah" but it doesn't seem to work. > > > > I'm using ant 1.53 and jdk 1.4.1_02 > > > > > > > > Thanks > > > > Mike > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: user-unsubscribe@ant.apache.org > > For additional commands, e-mail: user-help@ant.apache.org > > > > > > > > > > ______________________________________________________________________ > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: user-unsubscribe@ant.apache.org > > For additional commands, e-mail: user-help@ant.apache.org > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscribe@ant.apache.org > For additional commands, e-mail: user-help@ant.apache.org > > > "This information in this e-mail is intended solely for the addressee and > may contain information which is confidential or privileged. Access to this > e-mail by anyone else is unauthorized. If you are not the intended > recipient, or believe that you have received this communication in error, > please do not print, copy, retransmit, disseminate, or otherwise use the > information. Also, please notify the sender that you have received this > e-mail in error, and delete the copy you received." > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscribe@ant.apache.org > For additional commands, e-mail: user-help@ant.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For additional commands, e-mail: user-help@ant.apache.org