Return-Path: Delivered-To: apmail-jakarta-regexp-dev-archive@apache.org Received: (qmail 995 invoked from network); 3 Apr 2002 11:55:43 -0000 Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131) by daedalus.apache.org with SMTP; 3 Apr 2002 11:55:43 -0000 Received: (qmail 29041 invoked by uid 97); 3 Apr 2002 11:55:39 -0000 Delivered-To: qmlist-jakarta-archive-regexp-dev@jakarta.apache.org Received: (qmail 28904 invoked by uid 97); 3 Apr 2002 11:55:39 -0000 Mailing-List: contact regexp-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Regexp Developers List" Reply-To: "Regexp Developers List" Delivered-To: mailing list regexp-dev@jakarta.apache.org Received: (qmail 28687 invoked from network); 3 Apr 2002 11:55:38 -0000 Message-ID: <3CAAEDAA.13063D39@cheerful.com> Date: Wed, 03 Apr 2002 13:55:22 +0200 From: Holger Stratmann X-Mailer: Mozilla 4.72 [en] (WinNT; U) X-Accept-Language: en MIME-Version: 1.0 To: Regexp Developers List Subject: Re: backreferences References: <005601c1d764$8bb85760$d956ec0c@D93ZR511> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N Hi prasanna (sorry, which is the first name?), > RE r = new RE("foo_([0-9]{2}).xml"); > String new = r.subst("foo_28.xml", "blah_\1.xml"); > > Doesn't work. i get blah_\1.xml Well... the reason for this is obvious (sadly enough): RegExp does NOT support replacing backreferences... > any suggestions would be appreciated. I faced the same problem a few weeks ago and since I wanted to stick with the "lightweight" regexp, I implemented backrefs for myself. It's not yet "completely complete" (mostly, escaping backslashes is still missing). I'm planning to take another look at it soon, finish it and also submit the code... (along with a few other fixes and extensions) Right now, I implemented the functionality by subclassing rather than modifying RE.java (assuming there might be updates, I didn't want to "merge" my changes :-) If you (or anybody else?) want to have the sources, just send me an e-mail... If you prefer using "standard packages", I guess you could use ORO... HTH, Holger -- To unsubscribe, e-mail: For additional commands, e-mail: