How to manipulate the match data in Emacs Lisp?
September 04, 2023
(re-search-forward "foo-\\(.*\\)-baz")
(progn
(re-search-forward "foo-\\(.*\\)-baz")
(match-string 0))
(progn
(re-search-forward "foo-\\(.*\\)-baz")
(match-string 1))
(progn
(re-search-forward "foo-\\(.*\\)-baz")
(replace-match "^^^"))
(progn
(re-search-forward "foo-\\(.*\\)-baz")
(replace-match "^^^" nil nil nil 1))