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: Emanuel Berg
Subject: Re: Select/highlight and *copy* matches of some regex
Date: Tue, 28 Jun 2022 00:26:03 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

Joost Kremers 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...

You are a little surprised? It is like that all the time with
Elisp.

-- 
underground experts united
https://dataswamp.org/~incal




reply via email to

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