[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Using lisp code in query-replace-regexp
From: |
Emanuel Berg |
Subject: |
Re: Using lisp code in query-replace-regexp |
Date: |
Tue, 04 Nov 2014 20:57:27 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) |
Julien Cubizolles <j.cubizolles@free.fr> writes:
> I can use the following replace string (for lack of
> a better term) with query-replace-regexp
Yes, you can do that.
Check out this:
(while (re-search-forward REGEXP nil t)
(replace-match TO-STRING nil nil))
from the help of `replace-regexp'.
So instead of the `replace-match' stuff above, you
write a function that examines `match-beginning',
`match-end', and `match-string', and then use that as
input to your Elisp, to produce the on-the-fly
TO-STRING (in the phrasing of the above Elisp).
Good luck! When you get it to work, post it here :)
--
underground experts united