From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Joost Kremers Newsgroups: gmane.emacs.help Subject: Re: Regex to match lines with a specific number of words Date: Sun, 24 Apr 2022 00:21:35 +0200 Message-ID: <87fsm3qvv6.fsf@fastmail.fm> References: <87czh7ttzt.fsf@fastmail.fm> <877d7fscug.fsf@fastmail.fm> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="3625"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.6.10; emacs 28.1.50 Cc: help-gnu-emacs@gnu.org To: thibaut.verron@gmail.com Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Sun Apr 24 00:27:49 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 1niOEE-0000Vr-B2 for geh-help-gnu-emacs@m.gmane-mx.org; Sun, 24 Apr 2022 00:27:46 +0200 Original-Received: from localhost ([::1]:42214 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1niOED-0007Ow-1M for geh-help-gnu-emacs@m.gmane-mx.org; Sat, 23 Apr 2022 18:27:45 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37434) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1niODU-0007OY-HS for help-gnu-emacs@gnu.org; Sat, 23 Apr 2022 18:27:00 -0400 Original-Received: from wout2-smtp.messagingengine.com ([64.147.123.25]:32919) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1niODS-0000oX-Ol for help-gnu-emacs@gnu.org; Sat, 23 Apr 2022 18:27:00 -0400 Original-Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.west.internal (Postfix) with ESMTP id D46FA320112B; Sat, 23 Apr 2022 18:26:56 -0400 (EDT) Original-Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Sat, 23 Apr 2022 18:26:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastmail.fm; h= cc:cc:content-transfer-encoding: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=fm1; t=1650752816; x= 1650839216; bh=nNL9deOtzaJNUTmATJbAQf7rgS3uIUj7IBxngKvsbsw=; b=C 80vu/j+o01MKQwjbbq9LOvW18NoEgppmEaxig6E2a3tKFjJJ+Z41plmgJe1aP6nu ZaFnR95HEHZLwku7wyndBENd2Tfg3Sr0zlRFAxH3WTdMUuoV+3au48Kktb5oon7p FMNc/8yvuiqW7sXmPl3r1KXnuDsH49PcEdSK3TJbqqLstMi1iG04sKcbdfLTAB7G TtppQp7iXevRDVO8GydUjw6aknGobaPvQCTmSztyaBlht6inSDWeJAjvC+AdmRXO NO7mdIsoMyI50mNIK7RMatwa/gGL1Bnsc50tW46oPVBy0OmXxR2Bm87X98LO6dgC NXxRIYTKXhtCs2VNU1UNg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date: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=fm1; t=1650752816; x=1650839216; bh=nNL9deOtzaJNU TmATJbAQf7rgS3uIUj7IBxngKvsbsw=; b=sVzzMdU5dx9vtIMqThDoZJLbcUuLk dXaR6JUGCwqcQInDrHLhHQuZXodAGxFOTAt+6bthhDuWUQNmwJ/DJK+lRAkyD2lU u3pe+dQNN87QVlnpHxYIuWguSL/uStj8PBoklgSB2rvEQ/2xut1ieLLdRVOUmYK2 KEVVi23IsCLlzDeX1Hsa7kKRTHSJqw0LVxIbOVkmWihb1bPU9BOWmvVZ1SEEy1qf 8J0OqBKXMGWpCCPtK6x/GDdI54U5Qn7+qG/n0M6Hbjug+WG/OD7nbNrftl+fJzGd zM5dHVpAbXWInv2JeDHfvuSSCw7X3JOb1fgLnVz4pIvbrvZID8Jj1sKSQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrtdejgdduudcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhepfhgfhffvvefuffgjkfggtgfgsehtqh ertddtreejnecuhfhrohhmpeflohhoshhtucfmrhgvmhgvrhhsuceojhhoohhsthhkrhgv mhgvrhhssehfrghsthhmrghilhdrfhhmqeenucggtffrrghtthgvrhhnpeetleefgeevle fgkeeggeehjefhfeefueevhfeihfekffefkedthedtvedvhedtieenucevlhhushhtvghr ufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehjohhoshhtkhhrvghmvghrsh esfhgrshhtmhgrihhlrdhfmh X-ME-Proxy: Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 23 Apr 2022 18:26:55 -0400 (EDT) In-reply-to: Received-SPF: pass client-ip=64.147.123.25; envelope-from=joostkremers@fastmail.fm; helo=wout2-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, 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:137007 Archived-At: On Sat, Apr 23 2022, Thibaut Verron wrote: > No problem! The information is in the manual, but hidden behind several > layers of redirection. > I find the emacswiki page on regular expressions both more synthetic and > more informative. Thanks, I'll check it out. > Regarding performances, that's a bit strange. > Is it better if you add ^ and $ around the expression? Or if you add only= ^ > and search for exactly 30 repetitions (not 30 or more)? Well, either version still runs up one CPU core to 100%. The only difference seems to be that they are more easily interruptable with C-g: Emacs responds immediately, whereas before it would take seconds to respond to C-g and in = one case it did not respond at all. (I ended up killing Emacs when GNOME popped= up a a suggestion to do so...) > Le sam. 23 avr. 2022 =C3=A0 23:34, Joost Kremers a > =C3=A9crit : >> Lemme see if a function that goes through the buffer, splits every line = on >> white space and deletes those that are too long works better. That actually worked well. It still takes a few seconds to run, but really = just a few seconds. And that's including dumping all the extracted lines into a separate buffer. --=20 Joost Kremers Life has its moments