[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: multiple search strings in query-replace-regexp

From: David Kastrup
Subject: Re: multiple search strings in query-replace-regexp
Date: Tue, 10 Oct 2006 00:21:16 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

Ilya Zakharevich <address@hidden> writes:

> [A complimentary Cc of this posting was sent to
> Stefan Monnier 
> <address@hidden>], who wrote in article <address@hidden>:
>> > 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).

Your quoting does not make it clear who wrote what.  Anyway, you could
just use match-data, nthcdr, set-match-data and some other stuff to
just shift the match data appropriately before performing the

David Kastrup, Kriemhildstr. 15, 44793 Bochum

reply via email to

[Prev in Thread] Current Thread [Next in Thread]