unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: <tomas@tuxteam.de>
To: help-gnu-emacs@gnu.org
Subject: Re: Select/highlight and *copy* matches of some regex
Date: Mon, 27 Jun 2022 18:12:30 +0200	[thread overview]
Message-ID: <YrnW7kAtZ5KJPivD@tuxteam.de> (raw)
In-Reply-To: <82a978f3-e974-4d8f-b87e-5707ffec0b5b@www.fastmail.com>

[-- Attachment #1: Type: text/plain, Size: 1208 bytes --]

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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

  reply	other threads:[~2022-06-27 16:12 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-27 15:52 Select/highlight and *copy* matches of some regex Joost
2022-06-27 16:12 ` tomas [this message]
2022-06-27 17:16   ` Joost
2022-06-27 17:44     ` tomas
2022-06-28  4:40     ` Visuwesh
2022-06-28 19:52       ` Emanuel Berg
2022-06-29 21:40       ` Joost Kremers
2022-06-30  6:05         ` Emanuel Berg
2022-06-28  9:29     ` Daniel Martín
2022-06-28 10:33       ` tomas
2022-06-27 20:56 ` Stephen Berman
2022-06-27 21:09   ` Joost Kremers
2022-06-27 22:26     ` Emanuel Berg
2022-06-27 22:29     ` Emanuel Berg
2022-06-27 22:41       ` Emanuel Berg
2022-06-27 23:11         ` DWIM interface (was: Re: Select/highlight and *copy* matches of some regex) Emanuel Berg
2022-06-27 22:44       ` Select/highlight and *copy* matches of some regex Emanuel Berg
2022-06-28  4:43         ` tomas
2022-06-28  5:37           ` Emanuel Berg
2022-06-28  4:42   ` tomas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YrnW7kAtZ5KJPivD@tuxteam.de \
    --to=tomas@tuxteam.de \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).