unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Hongyi Zhao <hongyi.zhao@gmail.com>
To: PierGianLuca <luca@magnaspesmeretrix.org>
Cc: help-gnu-emacs@gnu.org
Subject: Re: Replace all occurrences of a specific character with another.
Date: Sun, 23 Jul 2023 08:36:25 +0800	[thread overview]
Message-ID: <CAGP6POLFZ6351YXaMZp=B0zZ2HjY78JQcSHjEH4oQS+sP98AmQ@mail.gmail.com> (raw)
In-Reply-To: <7a231b60-44e7-57fe-3f9c-99394aae2aa6@magnaspesmeretrix.org>

On Sat, Jul 22, 2023 at 11:08 PM PierGianLuca
<luca@magnaspesmeretrix.org> wrote:
>
> It looks like your character appears surrounded by non-letters in every instance. In this case you could use `query-replace-regexp` replacing
>
> \<d\>
>
> with
>
> n
>
> The "\<\>" brackets match beginning and end of words:
>
> https://www.gnu.org/software/emacs/manual/html_node/emacs/Regexp-
> Backslash.html
>
>
> Your character also seems to appear inside maths expressions only. In this case you could use the function defined in this post:
>
> http://stackoverflow.com/questions/19845598/emacs-regex-replacing-a-string-inside-a-latex-equation

Thank you for the nice tip, but there are several versions of
functions suggested there. So, which one is your preferred version?

> it's very useful and I use it regularly in LaTeX documents.
>
> Cheers,
> Luca

Regards,
Zhao

> On 230722 16:35, Hongyi Zhao wrote:
> > Hi here,
> >
> > I want to replace all occurrences of a specific character, say, `d`,
> > as shown in the attached screenshot, with another character, e.g.,
> > `n`. Is there any practical way to do this?
> >
> > Regards,
> > Zhao



  reply	other threads:[~2023-07-23  0:36 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-22 14:35 Replace all occurrences of a specific character with another Hongyi Zhao
2023-07-22 15:07 ` PierGianLuca
2023-07-23  0:36   ` Hongyi Zhao [this message]
2023-07-23 10:23     ` PierGianLuca
2023-07-23  2:18 ` Michael Heerdegen
2023-07-25 17:00 ` Emanuel Berg

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAGP6POLFZ6351YXaMZp=B0zZ2HjY78JQcSHjEH4oQS+sP98AmQ@mail.gmail.com' \
    --to=hongyi.zhao@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=luca@magnaspesmeretrix.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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).