Access Keys:
Skip to content (Access Key - 0)

How to perform a query replace in emacs

To replace a character string everywhere that it occurs within the current buffer, there is two ways to do it

M-x replace-string

will ask you for the string you want to replace and what you want to replace it with. Once you provide these, it will make the change globally within the buffer.

M-%

will also prompt you for the string to search for and the string to replace it. It differs from m-x replace-string in that it asks for verification before making each change.

In order to enter control characters in either of the above, they will have to be preceded by C-q. For example, ^J is typed as C-q C-j.

IS&T Contributions

Documentation and information provided by IS&T staff members


Last Modified:

June 05, 2014

Get Help

Request help
from the Help Desk
Report a security incident
to the Security Team
Labels:
olc-emacs olc-emacs Delete
emacs emacs Delete
perform perform Delete
query query Delete
replace replace Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
Feedback
This product/service is:
Easy to use
Average
Difficult to use

This article is:
Helpful
Inaccurate
Obsolete
Adaptavist Theme Builder (4.2.3) Powered by Atlassian Confluence 3.5.13, the Enterprise Wiki