Skip to main content Skip to navigation

2.8 Query replace

One final command you might find useful is the query replace. You already know how to do a global replace (Alt-x replace-string ). This is fine if every occurance of your chosen string is one that you want to change. But what if this is not the case, that you'd rather change only a selection of occurances of your chosen string? In this case use query replace with Alt-x-query-replace. For each occurance of your chosen string, emacs will give you the option of changing it or keeping it the same.