[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: Visuwesh
Subject: Re: Select/highlight and *copy* matches of some regex
Date: Tue, 28 Jun 2022 10:10:29 +0530
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

[திங்கள் ஜூன் 27, 2022] Joost wrote:

> 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=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...

I wonder if you can use C-u M-s o for the job.  I did 
C-u M-s o lang=.. then it produced a buffer with the contents


reply via email to

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