On Tue, Jun 28, 2022 at 11:29:51AM +0200, Daniel Martín wrote: [...] > You can pass the universal argument to occur to only show the matches > for the regexp, excluding the rest of the line. For example: > > C-u C-s REGEXP C-u M-s o > > This will show an *Occur* buffer with only the matching parts of REGEXP > in the current buffer, which you can save to a file, etc. Woah. I didn't know that one, thanks. This seems to come close to the OP's wishes, yes. Cheers -- t