[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [AUCTeX-devel] (old) TeX definitions and query-replace-regexp
From: |
Uwe Brauer |
Subject: |
Re: [AUCTeX-devel] (old) TeX definitions and query-replace-regexp |
Date: |
Sun, 10 Aug 2014 09:58:23 +0200 |
User-agent: |
Gnus/5.13001 (Ma Gnus v0.10) XEmacs/21.5-b33 (linux) |
> Hi Uwe,
> 2014-08-09 21:15 GMT+02:00 Uwe Brauer <address@hidden>:
> If you want to replace all occurrences of the regexp, using a `while
> re-search-forward' + `replace-match' is a better idea. Your error is
> that you aren't specifying groups for the two arguments of the macro,
> so you can't use them in the replace text.
> The following should do the trick:
> (while (re-search-forward "\\\\nv{\\([^}]*\\)}{\\([^}]*\\)}" nil t)
> (replace-match "\\\\|\\1\\\\|_{H^{\\2}}"))
> but please note that it will automatically replace all occurrences of
> \nv{...}{...}, so I'd suggest to try it in a test buffer.
> `re-builder' is your friend when you want to build regexp ;-)
Thanks very much, usually since I am always worried about global
replacing I usually use query-replace and then when I am convinced I use
! To replace all.
Thanks also for pointing out re-builder.
Uwe
smime.p7s
Description: S/MIME cryptographic signature