[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: query-replace-regexp number number+1
From: |
rturrado |
Subject: |
Re: query-replace-regexp number number+1 |
Date: |
12 Apr 2006 09:12:38 -0700 |
User-agent: |
G2/0.2 |
Thanks very much. That works nifty!
Roberto.
David Kastrup wrote:
> "rturrado" <rturrado@gmail.com> writes:
>
> > I've tried that, but it complains with an "Invalid use of '\' in
> > replacement text" error. I'm using GNU Emacs 21.3.1 on a SuSE bash.
> > What's the "developer Emacs" version?
>
> It announces itself as 22.0.something and has not yet been released.
> Some people provide snapshots, though. No idea whether there is
> something for SuSE (Mandriva has one). And one can, of course,
> compile a copy oneself.
>
> > Can I find a tutorial online explaining how to run commands/evaluate
> > expressions/and so on within a regexp?
>
> You could probably do
>
> M-: (query-replace-regexp "\\([0-9]+\\)" '(replace-eval-replacement format
> "%d" (1+ (string-to-number (match-string 1))))) RET
>
> But it is not exactly kosher.
>
> --
> David Kastrup, Kriemhildstr. 15, 44793 Bochum