[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 <nospam-abuse@ilyaz.org> writes:
> [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).
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
replacement.
--
David Kastrup, Kriemhildstr. 15, 44793 Bochum
- Re: multiple search strings in query-replace-regexp, (continued)
- Re: multiple search strings in query-replace-regexp, Ilya Zakharevich, 2006/10/07
- Message not available
- Re: multiple search strings in query-replace-regexp, David Kastrup, 2006/10/07
- Re: multiple search strings in query-replace-regexp, Ilya Zakharevich, 2006/10/07
- Re: multiple search strings in query-replace-regexp, David Kastrup, 2006/10/07
- Re: multiple search strings in query-replace-regexp, Ilya Zakharevich, 2006/10/07
- Re: multiple search strings in query-replace-regexp, Mathias Dahl, 2006/10/08
- Re: multiple search strings in query-replace-regexp, Kim F. Storm, 2006/10/08
- Message not available
- Re: multiple search strings in query-replace-regexp, Mathias Dahl, 2006/10/12
- Re: multiple search strings in query-replace-regexp, Stefan Monnier, 2006/10/09
- Re: multiple search strings in query-replace-regexp, Ilya Zakharevich, 2006/10/09
- Re: multiple search strings in query-replace-regexp,
David Kastrup <=
- Re: multiple search strings in query-replace-regexp, Ilya Zakharevich, 2006/10/09
- Re: multiple search strings in query-replace-regexp, Malte Spiess, 2006/10/07
- Re: multiple search strings in query-replace-regexp, David Kastrup, 2006/10/07
Re: multiple search strings in query-replace-regexp, Peter Dyballa, 2006/10/06
Message not available