Return-Path: Delivered-To: apmail-ant-user-archive@ant.apache.org Received: (qmail 8673 invoked by uid 500); 26 Jun 2003 18:33:08 -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 8611 invoked from network); 26 Jun 2003 18:33:07 -0000 Received: from adsl-67-122-217-237.dsl.snfc21.pacbell.net (HELO svsmtp01.SVTECHNOLOGY.COM) (67.122.217.237) by daedalus.apache.org with SMTP; 26 Jun 2003 18:33:07 -0000 Received: From svmail01.svtechnology.com ([192.168.253.3]) by svsmtp01.SVTECHNOLOGY.COM (WebShield SMTP v4.5 MR1a); id 1056652391325; Thu, 26 Jun 2003 11:33:11 -0700 X-MimeOLE: Produced By Microsoft Exchange V6.0.6249.0 content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: RE: replaceregexp help Date: Thu, 26 Jun 2003 11:33:10 -0700 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: replaceregexp help Thread-Index: AcM8C8Q3MnVzXo6TTgepU2DvX7u/hgAAmKhw From: "Michael Finger" To: "Ant Users List" X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N The single quotes were bombing, I did "'blah'" , but I got a parse error but I figured out a work around --=20 I just store the drive letter and drive dir and seperate props,=20 then I can do replace=3D"${driveletter}\\\\${actualldir}"..... The other workaround I found was to do 2 replaces, the 1st one writes the prop value without the slashes, then on the 2nd replace I add the slashes in, but it's not a=20 specific as I would like it too be... Mike -----Original Message----- From: peter reilly [mailto:peter.reilly@corvil.com] Sent: Thursday, June 26, 2003 10:57 AM To: Ant Users List Subject: RE: replaceregexp help 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? >=20 > JEff=20 > = -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-= =3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=20 > Jeffrey W. Faist=20 > Configuration Management Analyst=20 > Encoda Systems, Inc.=20 > 1999 Broadway, Suite 4000=20 > Denver, Colorado 80202-3050 USA=20 > jeff.faist@encodasystems.com=20 > Direct Phone Line: +1 (303) 390 8496=20 > Fax Line: +1 (303) 390 8425=20 >=20 >=20 > -----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 >=20 >=20 > 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=3D"change.properties" > match=3D".:[\\]+blah" > replace=3D"d:\\\\\\\\\localblah" > byline=3D"true" > flags=3D"i"/> >=20 > but the following may be better: > file=3D"change.properties" > match=3D"(.:)([\\]+)blah" > replace=3D"d:\2localblah" > byline=3D"true" > flags=3D"i"/> >=20 > peter. >=20 > 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,=20 > > 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.=20 > > What wierd is I got replace c:\\\\blah to go to --> c:\blah on the write,=20 > > but when I use a property, match=3D"${prop} where = prop=3Dc:\\\\\\\\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..... > > =20 > > Mike > > =20 > >=20 > > -----Original Message-----=20 > > From: Harkness, David [mailto:DHarkness@sonypictures.com]=20 > > Sent: Wed 6/25/2003 4:03 PM=20 > > To: Ant Users List=20 > > Cc:=20 > > Subject: RE: replaceregexp help > > =09 > > =09 > >=20 > > 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: > > =09 > > Match=3D".:\\\\?blah" > > =09 > > Each \\ becomes a single literal \ and ? means zero or one of the > > previous character/group. So that matches \ and \\ but not \\\. > > =09 > > 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 \). > > =09 > > Now for replacing, you need the same escaping: > > =09 > > replace=3D"d:\\\\localblah" > > =09 > > 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 > > =09 > > "d:\\localblah" --> "d:\localblah" --> "d:localblah" > > =09 > > 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. > > =09 > > Good luck! > > Dave > > =09 > > David Harkness > > Sony Pictures Digital Networks > > =09 > > -----Original Message----- > > From: Michael Finger [mailto:mfinger@SVTECHNOLOGY.com] > > Sent: Wednesday, June 25, 2003 3:44 PM > > To: Ant Users List > > Subject: replaceregexp help > > =09 > > =09 > > Hello, > > =09 > > I'm struggling a bit with the replaceregexp task. I have a property > file > > and > > =09 > > want to replace "c:\\blah" in the line > > "myproperty=3Dc:\\blah\\yadaa\\yack" with > > =09 > > "d:\\localblah" ... > > =09 > > Here's what i'm doing: > > =09 > > file=3D"${veritySearchDir}/config/verityindexer.properties" > > =09 > > match=3D".:..blah" > > =09 > > replace=3D"d:\\localblah" > > =09 > > byline=3D"true" > > =09 > > flags=3D"i"/> > > =09 > > =09 > > =09 > > but I'm getting: > > =09 > > myproperty=3Dd:localblah\\yadaa\\yack in the file... > > =09 > > and I want myproperty=3Dd:\localblah\\yadaa\\yack in the file... > > =09 > > I've also tried using @#x5c;... > > =09 > > Also, on the match part it would be nice to match c:\\blah and > c:\blah. > > I've tried match=3D ".:(\\*)blah" but it doesn't seem to work. > > =09 > > I'm using ant 1.53 and jdk 1.4.1_02 > > =09 > > =09 > > =09 > > Thanks > > =09 > > Mike > > =09 > > =09 > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: user-unsubscribe@ant.apache.org > > For additional commands, e-mail: user-help@ant.apache.org > > =09 > > =09 > >=20 > >=20 > > ______________________________________________________________________ > >=20 > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: user-unsubscribe@ant.apache.org > > For additional commands, e-mail: user-help@ant.apache.org >=20 >=20 > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscribe@ant.apache.org > For additional commands, e-mail: user-help@ant.apache.org >=20 >=20 > "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." >=20 >=20 > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscribe@ant.apache.org > For additional commands, e-mail: user-help@ant.apache.org >=20 >=20 --------------------------------------------------------------------- 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