I'm writing some elisp code and would like to replace some string with some another string in a buffer. Which elisp function does that ? I did a search on documentation for the related function but all I'm getting is the interactive commands. Would love to see a sample code if possible.
replace-match in a loop, or function
perform-replace. See the Elisp manual, node Search and Replace.
(while (re-search-forward "hello" nil t) (replace-match "world"))