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

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

Re: Replace all occurrences of a specific character with another.


From: PierGianLuca
Subject: Re: Replace all occurrences of a specific character with another.
Date: Sat, 22 Jul 2023 17:07:20 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0

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

it's very useful and I use it regularly in LaTeX documents.

Cheers,
Luca


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 via email to

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