From: Tassilo Horn <tsdh@gnu.org>
To: Pankaj Jangid <pankaj@codeisgreat.org>
Cc: help-gnu-emacs@gnu.org
Subject: Re: query-replace-regexp on a string with '=' sign
Date: Thu, 08 Sep 2022 12:49:07 +0200 [thread overview]
Message-ID: <87lequw2f4.fsf@gnu.org> (raw)
In-Reply-To: <87k06e477o.fsf@codeisgreat.org>
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
next prev parent reply other threads:[~2022-09-08 10:49 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-08 8:10 query-replace-regexp on a string with '=' sign Pankaj Jangid
2022-09-08 9:53 ` Emanuel Berg
2022-09-16 15:15 ` [External] : " Drew Adams
2022-09-18 15:24 ` Emanuel Berg
2022-09-08 10:49 ` Tassilo Horn [this message]
2022-09-08 11:16 ` Emanuel Berg
2022-09-09 4:11 ` Pankaj Jangid
2022-09-09 5:10 ` Tassilo Horn
2022-09-09 7:46 ` Pankaj Jangid
2022-09-09 9:26 ` Tassilo Horn
2022-09-09 12:50 ` Pankaj Jangid
2022-09-09 12:56 ` Tassilo Horn
2022-09-10 16:05 ` Pankaj Jangid
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87lequw2f4.fsf@gnu.org \
--to=tsdh@gnu.org \
--cc=help-gnu-emacs@gnu.org \
--cc=pankaj@codeisgreat.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.