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

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

Re: Replacement


From: Andreas Schwab
Subject: Re: Replacement
Date: Thu, 03 Nov 2005 18:59:23 +0100
User-agent: Gnus/5.110003 (No Gnus v0.3) Emacs/22.0.50 (gnu/linux)

hufflen@lifc.univ-fcomte.fr (hufflen jean-michel) writes:

> (while (re-search-forward "\\^{?a}?" ...) (replace-match "â" ...))

To match a backslash you must use the regex "\\\\".

> it results: \^{a} or \^a ====> \â

It results in ^{a} or ^a ===> â.  The backslash is not part of the match.

> If the replacement I wish is:
>
> \`{a} or \`a ====> à
>
> then (while (re-search-forward "\\`{?a}?" ...) (replace-match "à" ...))

This will only match "{a}" or "{a" or "a}" or "a" at the beginning of the
buffer, because \` only matches there.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."




reply via email to

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