From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ilya Zakharevich Newsgroups: gmane.emacs.help Subject: Re: multiple search strings in query-replace-regexp Date: Mon, 9 Oct 2006 21:53:17 +0000 (UTC) Organization: U.C. Berkeley Math. Department. Message-ID: References: <1160133442.016714.5230@m7g2000cwm.googlegroups.com> <85wt7cwkwc.fsf@lola.goethe.zz> NNTP-Posting-Host: main.gmane.org X-Trace: sea.gmane.org 1160433665 13146 80.91.229.2 (9 Oct 2006 22:41:05 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 9 Oct 2006 22:41:05 +0000 (UTC) Bcc: ilya Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Oct 10 00:40:59 2006 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1GX3nW-0002Bb-J5 for geh-help-gnu-emacs@m.gmane.org; Tue, 10 Oct 2006 00:40:35 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GX3nV-0006uL-Q5 for geh-help-gnu-emacs@m.gmane.org; Mon, 09 Oct 2006 18:40:33 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!newsfeed.berkeley.edu!ucberkeley!agate.berkeley.edu!ilya Original-Newsgroups: gnu.emacs.help Original-Lines: 34 Original-NNTP-Posting-Host: powdermilk.math.berkeley.edu Original-X-Trace: agate.berkeley.edu 1160430797 85486 169.229.140.13 (9 Oct 2006 21:53:17 GMT) Original-X-Complaints-To: usenet@agate.berkeley.edu Original-NNTP-Posting-Date: Mon, 9 Oct 2006 21:53:17 +0000 (UTC) User-Agent: trn [how to get a version via %-escapes???] with a custom header X-How-To-Reach-Me: The From: address is valid X-How-To-Disable-Cc: Put in the headers the line: Mail-Copies-To: never Originator: ilya@powdermilk.math.berkeley.edu Original-Xref: shelby.stanford.edu gnu.emacs.help:142314 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:37935 Archived-At: [A complimentary Cc of this posting was sent to Stefan Monnier ], who wrote in article : > > How about rereading what I wrote above? "To make it useful, one needs > > a function to count the number of parentheses in a given regular > > expression. Is there?" > > `regexp-opt-depth' claims to do that. I believe the version in Emacs-CVS is > pretty reliable. Thanks; still, when combining several regexps into one, one needs to fixup backreferences. Given the horrible ELisp regexp syntax, this requires some dirty backwacking... E.g., I'm not sure I would be able to do it right first time (hint: the newer CPerl facification of RegExps would do it very easy with Perl regexps; much harder to do it with ELisp...). Hmm, I see that at least in Elist v19, backreferences went only up to 9; sigh... Well, this is not needed very often, one could just (error "RegExp limitation hit, try to make pattern(s) with backreferences first") or some such. ------- Additionally, when interpolating replacement string, one should also shift match-group references by corresponding amount; but this is easier done in the code of interpolator (I hope it is in ELisp, not in C). Yours, Ilya