[Top][All Lists]

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

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

From: Joost
Subject: Re: Select/highlight and *copy* matches of some regex
Date: Mon, 27 Jun 2022 19:16:27 +0200
User-agent: Cyrus-JMAP/3.7.0-alpha0-713-g1f035dc716-fm-20220617.001-g1f035dc7

On Mon, 27 Jun 2022, at 18:12, 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=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 via email to

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