On Mon, Jun 27, 2022 at 10:56:46PM +0200, Stephen Berman wrote: > On Mon, 27 Jun 2022 17:52:48 +0200 Joost wrote: > > > Hi all, > > > > I've been looking for at least an hour for something that my Sublime-using > > colleagues seem to be able to do out of the box... Highlight all matches of > > some regex in the current buffer and then copy/kill *all* of those matches so > > that you can yank them in a new buffer. > > > > The first part, highlighting all matches, is not a problem. But I haven't > > found a way yet to then extract all matches. > > Is this (suitably tweaked) good enough? > > (let ((matches "")) > (while (re-search-forward "lang=.." nil t) > (setq matches (concat matches (match-string 0) "\n"))) > (kill-new matches)) Nifty :) You'll end up with one big string of all concatenated matches. But it's a start. Cheers -- t