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: Sat, 23 Apr 2022 23:20:58 +0200 Message-ID: <877d7fscug.fsf@fastmail.fm> References: <87czh7ttzt.fsf@fastmail.fm> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="1098"; 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 Sat Apr 23 23:35:50 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 1niNPw-000AcP-JJ for geh-help-gnu-emacs@m.gmane-mx.org; Sat, 23 Apr 2022 23:35:49 +0200 Original-Received: from localhost ([::1]:49616 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1niNPv-0006xx-6u for geh-help-gnu-emacs@m.gmane-mx.org; Sat, 23 Apr 2022 17:35:47 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:58498) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1niNP6-0006xb-1g for help-gnu-emacs@gnu.org; Sat, 23 Apr 2022 17:34:56 -0400 Original-Received: from wout5-smtp.messagingengine.com ([64.147.123.21]:48689) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1niNP4-000209-5A for help-gnu-emacs@gnu.org; Sat, 23 Apr 2022 17:34:55 -0400 Original-Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id 66BE03200F81; Sat, 23 Apr 2022 17:34:52 -0400 (EDT) Original-Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Sat, 23 Apr 2022 17:34:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastmail.fm; h= cc: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=fm1; t=1650749691; x=1650836091; bh=vPqROD9jQP mNOFOPoPFrSL0DlnTc6v+yU8jiu0q5Pko=; b=QuFJB/VLPOQzoq3XjSVRtX0lZq GW3wPt0BKZne87A8Vu5OxL4CpqTyCVZWLw4HzwNQrAmYpvQk2GeYHwdwdRk19Oyy xMPQVbJI3dH/OYjE5h+6KoUv6njeVScSLMoKJindMVQomJyKu+EeNu4YUqaAo6Ne 3Sk//pwnkUa+yyavoVUw/uBv6JYHm3r+e0+DXCBIImn+nvmUC07DGEw/A5dP5Wax zxRT/ja2uonV9IYhYybcO1+HpQvGnJSussECerLvbAFj2R36XBGzGzxLqavLLCzU kdCpRnPGtxUZSZS69bjsxPPSlt9JShH+RSqCpgsvDvxJsKqPnT3Au5eNKTiQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc: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:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1650749691; x= 1650836091; bh=vPqROD9jQPmNOFOPoPFrSL0DlnTc6v+yU8jiu0q5Pko=; b=p DC7ymRD07tN4dKncL70M6jKz/wngBx7B34obrkdpKhOZFA6QpSP73Msb+ZdZQ41j NgtR4y8BDe2V3oVz9hUSj81fI7I9VmsIiDmcfhkfYHdCxL1EB38FYcjGIlp7nXCi s9pnmns3qVcJbtDoawhWWyYCB1MKKfKKS1dcyn503L5qRwFBcP5Wgy6CNN6/pHEs Q/qCWwkH0CmOVCel7JzvTljnsP6YPAToo7PMl2b1xYbljamgt2Rt3gebL5A7qLvw 6Fj40vKRyETn3XehdarSpKdmxd/3iDM2jT5CCyNOKUY+pR7RYUT+HWCHgAdb/q2i gIs9ZuupdwrxsLl/ZNlhQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrtdejucetufdoteggodetrfdotffvucfrrh hofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgenuceurghi lhhouhhtmecufedttdenucenucfjughrpehffgfhvfevufffjgfkgggtsehttdertddtre dtnecuhfhrohhmpeflohhoshhtucfmrhgvmhgvrhhsuceojhhoohhsthhkrhgvmhgvrhhs sehfrghsthhmrghilhdrfhhmqeenucggtffrrghtthgvrhhnpefgiefhuddtteeljeehve ekjedtffeuheffhffffeetieetfeehtdektdeitdekffenucevlhhushhtvghrufhiiigv pedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehjohhoshhtkhhrvghmvghrshesfhgrsh htmhgrihhlrdhfmh X-ME-Proxy: Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 23 Apr 2022 17:34:50 -0400 (EDT) In-reply-to: Received-SPF: pass client-ip=64.147.123.21; envelope-from=joostkremers@fastmail.fm; helo=wout5-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:137004 Archived-At: On Sat, Apr 23 2022, Thibaut Verron wrote: > The group [:space:] also matches newline characters. So your search has > exactly one match, spanning many lines. > You can use [:blank:] instead to match spaces and tabs only, for the > separator. Thanks! I never would have thought of that. (Why isn't this mentioned explicitly in the manual?) Unfortunately, passing this regexp to `flush-lines` or `kill-matching-lines` in a file of close to 65000 lines completely cripples Emacs... One CPU core runs up to 100% and Emacs becomes unresponsive. 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. Thanks, though, for the quick reply! -- Joost Kremers Life has its moments