From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Joost Newsgroups: gmane.emacs.help Subject: Re: Select/highlight and *copy* matches of some regex Date: Mon, 27 Jun 2022 19:16:27 +0200 Message-ID: <8543a730-b78f-491f-a3a9-66e23034f0d9@www.fastmail.com> References: <82a978f3-e974-4d8f-b87e-5707ffec0b5b@www.fastmail.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="4303"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Cyrus-JMAP/3.7.0-alpha0-713-g1f035dc716-fm-20220617.001-g1f035dc7 To: fatiparty--- Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Mon Jun 27 19:19:38 2022 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o5sOf-0000vU-1d for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 27 Jun 2022 19:19:37 +0200 Original-Received: from localhost ([::1]:51328 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o5sOe-000227-2A for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 27 Jun 2022 13:19:36 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:49238) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5sLz-00088I-RW for help-gnu-emacs@gnu.org; Mon, 27 Jun 2022 13:16:52 -0400 Original-Received: from out1-smtp.messagingengine.com ([66.111.4.25]:51767) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5sLy-00061b-71 for help-gnu-emacs@gnu.org; Mon, 27 Jun 2022 13:16:51 -0400 Original-Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 6DEE25C018C for ; Mon, 27 Jun 2022 13:16:48 -0400 (EDT) Original-Received: from imap44 ([10.202.2.94]) by compute2.internal (MEProxy); Mon, 27 Jun 2022 13:16:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastmail.fm; h= cc:content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to; s=fm2; t=1656350208; x=1656436608; bh=xErmafjKG9 Kdjvk6BIKS7/XRDfZ9EAxYbFQXCiGAw9g=; b=W6RaIc53dS5wOXCdXQF/wzIzRz OHbCUY8eFISTEOhxWfYuknN4upzSYMZRYVxDJUdNbUuE7TmJQ3/J4Lgb+0o/9oRk Z3nEvRwHFgBuuIoeIAEqRpTRmOLXWhbH4LcugKFcN/7x5srfgowqj+yKCT80kqNX ayKyNqn6GZn80lARdHc8CPgym5c7YMuYt6vBBgiKc0L3zlHDB2KjLBMkyD53EC5q ilx+LM67OzT2eXewdhOqqXUurhKvcYPfT/bCOBK1ipFagHJKs+vUXA0xyOFApDjY wVnKAk9MdNe8s9Mn5Sdr74KLpb/Yit3Pj1SSky35zrUQ5aKc1MueynZBRYXg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:date:feedback-id :feedback-id:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:sender:subject:subject:to:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; t=1656350208; x=1656436608; bh=xErmafjKG9Kdjvk6BIKS7/XRDfZ9 EAxYbFQXCiGAw9g=; b=lKEqQdZbSxgqmgmX9AMDjsgK2YqPfQ8smHTQZ+OcD8fW fBtL/35xWLp0YT2o/jf1r7lxnpBlqd8dRi/pHPHZYT5Y77BTauJybpJdP49jx6fZ WYZW1iTscVRyCDKz3YmfYSRaud8Uii6CQ3sQAefemXkAXF08WSdAc6j/AbVLOd0W 586Mq81EkVih4VzDSPFOFLfWfKbIhNpy7F8g55pu8xAX4OzoxPg5BpcaUL6l7pxt NFx4sv+XmC1g3K6cZW6O9NoJk5+ZY/Qx7seOEjfr9rP+IG4WcIcOlXcIUu6MZvON y9PgYvCLvMCQO3iwQYgTFlX868Y6ennlqK6HV0zPsQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrudeghedguddufecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurhepofgfggfkjghffffhvffutgesth dtredtreertdenucfhrhhomheplfhoohhsthcuoehjohhoshhtkhhrvghmvghrshesfhgr shhtmhgrihhlrdhfmheqnecuggftrfgrthhtvghrnheptdffjefgteffveevkeetgfdvgf fhieevfedtueevhfejveffudelhfelhffgkeejnecuvehluhhsthgvrhfuihiivgeptden ucfrrghrrghmpehmrghilhhfrhhomhepjhhoohhsthhkrhgvmhgvrhhssehfrghsthhmrg hilhdrfhhm X-ME-Proxy: Feedback-ID: ie15541ac:Fastmail Original-Received: by mailuser.nyi.internal (Postfix, from userid 501) id 3FA0A36A0071; Mon, 27 Jun 2022 13:16:48 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface In-Reply-To: Received-SPF: pass client-ip=66.111.4.25; envelope-from=joostkremers@fastmail.fm; helo=out1-smtp.messagingengine.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:138129 Archived-At: 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