Skip to content

How to replace regexp in buffers in Emacs Lisp?

(replace-regexp "foo" "XXX")
(while (re-search-forward "foo" nil t)
  (replace-match "XXX"))