all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Ilya Zakharevich <nospam-abuse@ilyaz.org>
Subject: Re: multiple search strings in query-replace-regexp
Date: Mon, 9 Oct 2006 21:53:17 +0000 (UTC)	[thread overview]
Message-ID: <egegcd$2jfe$1@agate.berkeley.edu> (raw)
In-Reply-To: jwvu02epwqf.fsf-monnier+gnu.emacs.help@gnu.org

[A complimentary Cc of this posting was sent to
Stefan Monnier 
<monnier@iro.umontreal.ca>], who wrote in article <jwvu02epwqf.fsf-monnier+gnu.emacs.help@gnu.org>:
> > 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

  reply	other threads:[~2006-10-09 21:53 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-06 11:17 multiple search strings in query-replace-regexp Florian Kaufmann
2006-10-06 11:27 ` Malte Spiess
2006-10-06 11:41   ` Florian Kaufmann
2006-10-06 11:51     ` David Kastrup
2006-10-06 21:45       ` Ilya Zakharevich
2006-10-06 22:01         ` David Kastrup
2006-10-07  3:45           ` Ilya Zakharevich
     [not found]           ` <200610070345.k973jLj2011358@powdermilk.math.berkeley.edu>
2006-10-07  7:41             ` David Kastrup
2006-10-07  8:57               ` Ilya Zakharevich
2006-10-07  9:11                 ` David Kastrup
2006-10-07 22:04                   ` Ilya Zakharevich
2006-10-08 13:47                     ` Mathias Dahl
2006-10-08 20:55                       ` Kim F. Storm
     [not found]                       ` <mailman.7905.1160340972.9609.help-gnu-emacs@gnu.org>
2006-10-12 15:44                         ` Mathias Dahl
2006-10-09  6:07                     ` Stefan Monnier
2006-10-09 21:53                       ` Ilya Zakharevich [this message]
2006-10-09 22:21                         ` David Kastrup
2006-10-10  3:39                           ` Ilya Zakharevich
2006-11-23 19:23                         ` Stefan Monnier
2006-10-07  8:20       ` Malte Spiess
2006-10-07  8:40         ` David Kastrup
2006-10-06 12:41 ` Peter Dyballa
     [not found] ` <mailman.7806.1160138473.9609.help-gnu-emacs@gnu.org>
2006-10-06 14:14   ` Florian Kaufmann
2006-10-06 15:14     ` David Kastrup
2006-10-06 15:29       ` Florian Kaufmann
2006-10-06 15:47         ` David Kastrup

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='egegcd$2jfe$1@agate.berkeley.edu' \
    --to=nospam-abuse@ilyaz.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.