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

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

Re: query-replace-regexp-swap ?


From: David Kastrup
Subject: Re: query-replace-regexp-swap ?
Date: Sat, 26 Nov 2005 07:14:44 +0100
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

Bastien <bastien@xxx.fr> writes:

> I often come across this problem: how to swap two strings in a buffer?
> For instance, say that you want to exchange #000 and #FFF in an HTML
> page: all #000 should become #FFF and all #FFF should become #000.
>
> How to do this with one *single* function ?

If you are using Emacs CVS (which your headers indicate), the
following should do the trick:

C-M-% #\(\(000\)\|FFF\) RET \,(if &2 "FFF" "000") RET

If you want to know how to do this non-interactively, type
C-x ESC ESC
after the above command.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum


reply via email to

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