unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Joost <joostkremers@fastmail.fm>
To: fatiparty--- <help-gnu-emacs@gnu.org>
Subject: Re: Select/highlight and *copy* matches of some regex
Date: Mon, 27 Jun 2022 19:16:27 +0200	[thread overview]
Message-ID: <8543a730-b78f-491f-a3a9-66e23034f0d9@www.fastmail.com> (raw)
In-Reply-To: <YrnW7kAtZ5KJPivD@tuxteam.de>

On Mon, 27 Jun 2022, at 18:12, tomas@tuxteam.de wrote:
> 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).

Sorry, I meant to mention that, but I forgot. No, selecting lines is not an option, because it's the non-matching parts of each line that I'm trying to get rid of.

In my particular use case, I'm trying to clean up a file that looks something like this:

```
blah blah lang=en bla
lang=de
lang=fr blah blah
blah lang=pt
```

The part I'm interested in is "lang=xx", the rest needs to be removed. Each line contains this part (with different language codes), but may contain more text, which is irrelevant to me. There's no pattern to the irrelevant part, it can basically be any text.

I can highlight them with `highlight-regexp`, search for them with isearch, but there doesn't seem to be a straightforward way to copy or kill them...


-- 
Joost Kremers
Life has its moments



  reply	other threads:[~2022-06-27 17:16 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
2022-06-27 17:16   ` Joost [this message]
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=8543a730-b78f-491f-a3a9-66e23034f0d9@www.fastmail.com \
    --to=joostkremers@fastmail.fm \
    --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).