help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: replace-regexp question


From: David Kastrup
Subject: Re: replace-regexp question
Date: Wed, 26 Oct 2005 19:34:11 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

Neon Absentius <absent@sdf.lonestar.org> writes:

> Is there a way to use the command replace-regexp to replace a number with 
> that number increased, say, by 15?  I tried 
>
> C-M-% -?[0-9]+ RET (number-to-string (+ (string-to-number "\&") 15)) RET
>
> but it doesn't work because emacs interprets the second input to be
> a string and so it doesn't evaluate it.  So I guess the question is
> how can we use the result of evaluating a sexp for replacement text?
>
> Any help and/or pointers to documentation will be greatly
> appreciated.

The development version of Emacs would offer
C-M-% -?[0-9]+ RET \,(+ \#& 15) RET

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum


reply via email to

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