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

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

Re: regexp-quote for replacements


From: Stefan Monnier
Subject: Re: regexp-quote for replacements
Date: Mon, 13 Sep 2004 16:17:04 GMT
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3.50 (gnu/linux)

> I want to construct replacement patterns automatically.
> Does the following piece of code insert the value of bar in the
> replacement, no matter what the string bar is?
> The point is that I want the optional arg LITERAL of replace-match
> to be nil.

>        ;; the following is like regexp-quote for replacements?
>        (baz (replace-regexp-in-string "\\\\" "\\\\" bar nil t)))

Yes, this will do a "quote" w.r.t the `literal' argument of
replace-match.  But it won't protect from case-fiddling.  For that I think
the only solution is the `fixedcase' argument (i.e. global to the
whole replacement text).


        Stefan

reply via email to

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