help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Select/highlight and *copy* matches of some regex


From: Joost Kremers
Subject: Re: Select/highlight and *copy* matches of some regex
Date: Mon, 27 Jun 2022 23:09:51 +0200
User-agent: mu4e 1.6.11; emacs 28.1.50

On Mon, Jun 27 2022, Stephen Berman wrote:
> On Mon, 27 Jun 2022 17:52:48 +0200 Joost <joostkremers@fastmail.fm> wrote:
>> 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))

Yeah, it's easy to code something up that collects all matches of some regex is
a buffer. I'm just a little surprised that this isn't already possible, from
isearch or hi-lock-mode or something...

-- 
Joost Kremers
Life has its moments



reply via email to

[Prev in Thread] Current Thread [Next in Thread]