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

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

Re: query-replace-regexp on a string with '=' sign


From: Tassilo Horn
Subject: Re: query-replace-regexp on a string with '=' sign
Date: Thu, 08 Sep 2022 12:49:07 +0200
User-agent: mu4e 1.9.0; emacs 29.0.50

Pankaj Jangid <pankaj@codeisgreat.org> writes:

> I have a line like this,
>   HELLO=WORLD
> now I want to downcase the part before the equal (=) sign.
> I am approaching like this
>
>  M-x query-replace-regexp RET \(.+\)= RET \,(downcase \1)= RET
>
> But this doesn't work.

Where "doesn't work" means "doesn't downcase but keeps HELLO", right?
Have a look at (info "(emacs) Replacement and Lax Matches") which
explains it.  I think the default `case-replace' value of t is the
problem here.

That said, `case-replace' is actually a nice feature.  It's just that
with an explicit `downcase' it's very counter-intuitive.  I'd suggest to
report that as a bug.

What you can do is instead of saying 'y' when asked to replace the
current occurrence do 'E RET' instead.

> It works if the equal sign is replaced with another non-special ASCII
> character.

I don't understand what you mean here.  When I change the = in the
replacement to, say, the letter t, HELLO= gets replaced with HELLOT
which is the same behavior as above...

Bye,
Tassilo



reply via email to

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