From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Noam Postavsky Newsgroups: gmane.emacs.bugs Subject: bug#34641: rx: (or ...) order unpredictable Date: Mon, 25 Feb 2019 09:43:07 -0500 Message-ID: References: <836B8DC2-9358-40AC-83AF-7C4D960D9A53@acm.org> <07B35E27-3082-4DDD-A1C9-0D8286D40452@acm.org> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="160110"; mail-complaints-to="usenet@blaine.gmane.org" Cc: 34641@debbugs.gnu.org To: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Feb 25 15:44:13 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gyHUK-000fYG-IB for geb-bug-gnu-emacs@m.gmane.org; Mon, 25 Feb 2019 15:44:12 +0100 Original-Received: from localhost ([127.0.0.1]:38480 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gyHUJ-0001uC-Bo for geb-bug-gnu-emacs@m.gmane.org; Mon, 25 Feb 2019 09:44:11 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:57521) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gyHUC-0001u6-S5 for bug-gnu-emacs@gnu.org; Mon, 25 Feb 2019 09:44:05 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gyHUB-0000DB-G9 for bug-gnu-emacs@gnu.org; Mon, 25 Feb 2019 09:44:04 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:37431) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gyHUA-0000Bl-JC for bug-gnu-emacs@gnu.org; Mon, 25 Feb 2019 09:44:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1gyHUA-0003uO-FN for bug-gnu-emacs@gnu.org; Mon, 25 Feb 2019 09:44:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Noam Postavsky Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 25 Feb 2019 14:44:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 34641 X-GNU-PR-Package: emacs Original-Received: via spool by 34641-submit@debbugs.gnu.org id=B34641.155110580714971 (code B ref 34641); Mon, 25 Feb 2019 14:44:02 +0000 Original-Received: (at 34641) by debbugs.gnu.org; 25 Feb 2019 14:43:27 +0000 Original-Received: from localhost ([127.0.0.1]:50975 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gyHTa-0003tO-JY for submit@debbugs.gnu.org; Mon, 25 Feb 2019 09:43:26 -0500 Original-Received: from mail-oi1-f175.google.com ([209.85.167.175]:46227) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gyHTX-0003tA-Sr for 34641@debbugs.gnu.org; Mon, 25 Feb 2019 09:43:24 -0500 Original-Received: by mail-oi1-f175.google.com with SMTP id j135so7401087oib.13 for <34641@debbugs.gnu.org>; Mon, 25 Feb 2019 06:43:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=FFKN+5moHrovG3mnWj4LxH5H7pRb/W3n8Ev0EKNMul0=; b=U6zTWIYb+NhIiX/yoDFQOpwV1zZoWeonkHQRZ2XEw0/zeaRM7F69hjs+DbxC/md5dv ppNs8RLdnQeQ8iQpBvQLNBC4KggVDX059lvjCYsby3TmiPio5BSfffw4axUZBGCm5kCh r7GUBVl11gW6o4hHHLxkYVkZinS40GEg6Ar7+Ze9mCDLOiu4YDd6qO/1op5t3EAfVDjI /qK1M+ZalDeGKlRGPvCL6VrIcwBCsKOjpWpIxmo087naMD5PHAPwjMj7Duw6yhVpTLkq xNCUj1Bb2ToLArofbBfCSUk1yDf4mmo0DS8g5hytyFdYpfsWVxqmpTslTKgbkR3u1ovp 1d6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=FFKN+5moHrovG3mnWj4LxH5H7pRb/W3n8Ev0EKNMul0=; b=SkaYqz4Au68wbVucRg8ZWapiI48z6jgBumZTQSTOxUdwYN+LEgASN+buQW6ISdju2v YNh9jKSAI6mLNmVX7sVR4fR8yW8EeNhH+BCkQMqR+Ws+QE5qnffcTP9nOmuep2MPTvC+ 67JTzVr3Xe+e0VZy1XxIXjiJizGlHr+Cd1ys4jTYA759OI9P5MzZTHNUsIBTqZiesZUH mqO5WSzNJm8NgVRUiLwG7bRRBBzvqe2zuWMRoMT7InxFFefYyDf4eSfHwjWACci4hFUT D1+UkglHfcSA9vpUG/QdSQ7U1qPynoG1HozrLOk7VUVnxHl2GRecvpci2+tAiYUWO/C3 h1Iw== X-Gm-Message-State: AHQUAubRKu78z8UwdtwWOkn2WFt9DJVp+FXCUVeR/XC7Fw8MvZK0IPWV rp+fCNjaXtthqGaeIbiNhW6m3IT3xKRIMDDPSLM= X-Google-Smtp-Source: AHgI3IZA1BR8tTUYiNja/Tmd8MnlOZM4XmjHZC7ppy5IzKn4hcyBZGR2iAdpn6gM7fnhhfE3QWzQ9MyKsxbXHm/VAOQ= X-Received: by 2002:aca:5e8b:: with SMTP id s133mr11502604oib.2.1551105798184; Mon, 25 Feb 2019 06:43:18 -0800 (PST) In-Reply-To: <07B35E27-3082-4DDD-A1C9-0D8286D40452@acm.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:155765 Archived-At: On Mon, 25 Feb 2019 at 04:56, Mattias Engdeg=C3=A5rd wro= te: > Good question! When the match is anchored at the end, they are indeed equ= ivalent. They also are equivalent for Posix regexps, which prefer the longe= st match. But in Emacs, the first (leftmost) matching alternative is used. > > Suppose we are matching against the string "abc". Then > ab\|a matches "ab" > a\|ab matches "a" Oh, huh. So it does. I guess I've never used regexp in a situation where this subtle corner case would come up. > >> (Speaking of regexp-opt, it has another bug that does not affect rx: i= t returns the empty string if given an empty list of strings. The correct r= eturn value is a regexp that never matches anything. > > > > This sounds familiar, though I can't locate a report for it. > > If you do remember, please tell us about it. > The `or' operator in SRE can be used with an empty argument list, and wil= l then not match anything. It is a useful limit case for machine-generated = regexps. Right, found it this time, it's Bug#20307.