From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= Newsgroups: gmane.emacs.devel Subject: Re: Scan of Emacs regexp mistakes Date: Thu, 16 Apr 2020 20:01:37 +0200 Message-ID: <591CE88A-E6D4-49DD-A915-DDA0557FE49B@acm.org> References: <140DB045-4529-4862-99B8-5F0DEF1EE8D4@acm.org> <1b6dd79d-837a-decc-deae-97bf9bc9c460@cs.ucla.edu> Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.14\)) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="106985"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel To: Paul Eggert Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Apr 16 20:10:59 2020 Return-path: Envelope-to: ged-emacs-devel@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 1jP8yY-000Rjs-Vw for ged-emacs-devel@m.gmane-mx.org; Thu, 16 Apr 2020 20:10:58 +0200 Original-Received: from localhost ([::1]:37804 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jP8yX-0001XO-TX for ged-emacs-devel@m.gmane-mx.org; Thu, 16 Apr 2020 14:10:57 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:42137) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jP8xy-00011h-TP for emacs-devel@gnu.org; Thu, 16 Apr 2020 14:10:23 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jP8xx-0006t7-6Y for emacs-devel@gnu.org; Thu, 16 Apr 2020 14:10:22 -0400 Original-Received: from mail1450c50.megamailservers.eu ([91.136.14.50]:38446 helo=mail265c50.megamailservers.eu) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jP8xw-0006sH-A9 for emacs-devel@gnu.org; Thu, 16 Apr 2020 14:10:21 -0400 X-Authenticated-User: mattiase@bredband.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu; s=maildub; t=1587060100; bh=v2k9EeZL2zpnovFtiaHIxG7y/BZxQfqFMS0zly9U3gY=; h=Subject:From:In-Reply-To:Date:Cc:References:To:From; b=BqfyjRSfsW/tZIYCiPZSz/noYPC05zqXgH/V1rnAwCL268OoOgDRDqSIKQCz0fl3m n0z9z3i2Fg71jfFVuLKXixgzmEmLRfpA6vOVmPO0vULke8ogz6rFWbt+lpqRyqYOsw dMVqxAKjYMdFahGLE+YaIRFiDLaU/5invRBsrV2c= Feedback-ID: mattiase@acm.or Original-Received: from [192.168.0.4] (c188-150-171-71.bredband.comhem.se [188.150.171.71]) (authenticated bits=0) by mail265c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id 03GI1bew000744; Thu, 16 Apr 2020 18:01:40 +0000 In-Reply-To: <1b6dd79d-837a-decc-deae-97bf9bc9c460@cs.ucla.edu> X-Mailer: Apple Mail (2.3445.104.14) X-CTCH-RefID: str=0001.0A782F16.5E989D55.006B, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 X-CTCH-VOD: Unknown X-CTCH-Spam: Unknown X-CTCH-Score: 0.000 X-CTCH-Flags: 0 X-CTCH-ScoreCust: 0.000 X-CSC: 0 X-CHA: v=2.3 cv=D5w51cZj c=1 sm=1 tr=0 a=SF+I6pRkHZhrawxbOkkvaA==:117 a=SF+I6pRkHZhrawxbOkkvaA==:17 a=jpOVt7BSZ2e4Z31A5e1TngXxSK0=:19 a=kj9zAlcOel0A:10 a=M51BFTxLslgA:10 a=QP-2Sxom_cy_PI6SyvQA:9 a=CjuIK1q_8ugA:10 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] X-Received-From: 91.136.14.50 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:247110 Archived-At: 16 apr. 2020 kl. 18.08 skrev Paul Eggert : >> - (while (re-search-forward "\\([ \t]*\n[ \t]*\\)+" nil t) >> + (while (re-search-forward "[ \t]*\\(?:\n[ \t]*\\)+" nil t) >> (replace-match " ")) >=20 > Wouldn't it be better to use "[ \t]*\n[ \t\n]*"? Superior in every way, thank you! Evidenced by disassembling them: your = pattern results in both loops being optimised, compared to only the = first (of three) in my clumsy attempt.