[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Select/highlight and *copy* matches of some regex
From: |
tomas |
Subject: |
Re: Select/highlight and *copy* matches of some regex |
Date: |
Mon, 27 Jun 2022 18:12:30 +0200 |
On Mon, Jun 27, 2022 at 05:52:48PM +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.
>
> I've also looked for third-party packages, but haven't been able to find
> anything. I read a few times that `multiple-cursors` can kill all matches as
> a rectangle, so that you can use `yank-rectangle`, but I haven't been able to
> make that work.
>
> So what am I overlooking here? I mean, there *must* be a way, right?
Not a direct answer to your question, but perhaps similar. If you
can live with selecting /lines/ containing a match, there's "occur"
(M-x occur).
Each match is a "live link" to the location. You can even edit the
matches in the occur buffer itself (key 'e').
I didnt try what happens when you do a query-replace in the occur
buffer while it is in "edit" mode. But worth a try ;-)
Cheers
--
t
signature.asc
Description: PGP signature
- Select/highlight and *copy* matches of some regex, Joost, 2022/06/27
- Re: Select/highlight and *copy* matches of some regex,
tomas <=
- Re: Select/highlight and *copy* matches of some regex, Joost, 2022/06/27
- Re: Select/highlight and *copy* matches of some regex, Visuwesh, 2022/06/28
- Re: Select/highlight and *copy* matches of some regex, Emanuel Berg, 2022/06/28
- Re: Select/highlight and *copy* matches of some regex, Joost Kremers, 2022/06/29
- Re: Select/highlight and *copy* matches of some regex, Emanuel Berg, 2022/06/30
Re: Select/highlight and *copy* matches of some regex, Stephen Berman, 2022/06/27