From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel,gmane.emacs.pretest.bugs Subject: Re: Should not * be greedy in a regexp? Date: Sat, 03 Nov 2007 21:55:29 -0400 Message-ID: References: <472CB6AB.9020301@gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1194141351 8017 80.91.229.12 (4 Nov 2007 01:55:51 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 4 Nov 2007 01:55:51 +0000 (UTC) Cc: emacs-pretest-bug@gnu.org To: "Lennart Borgman \(gmail\)" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Nov 04 02:55:54 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1IoUiQ-00050Q-9B for ged-emacs-devel@m.gmane.org; Sun, 04 Nov 2007 02:55:54 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IoUiF-00015K-SE for ged-emacs-devel@m.gmane.org; Sat, 03 Nov 2007 21:55:43 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IoUiB-00014E-UN for emacs-devel@gnu.org; Sat, 03 Nov 2007 21:55:39 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IoUi9-000138-28 for emacs-devel@gnu.org; Sat, 03 Nov 2007 21:55:39 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IoUi8-000135-Qf for emacs-devel@gnu.org; Sat, 03 Nov 2007 21:55:36 -0400 Original-Received: from fencepost.gnu.org ([140.186.70.10]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1IoUi8-0002me-H3 for emacs-devel@gnu.org; Sat, 03 Nov 2007 21:55:36 -0400 Original-Received: from mail.gnu.org ([199.232.76.166] helo=mx10.gnu.org) by fencepost.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1IoUi8-0005FI-3H for emacs-pretest-bug@gnu.org; Sat, 03 Nov 2007 21:55:36 -0400 Original-Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1IoUi4-0002lO-1d for emacs-pretest-bug@gnu.org; Sat, 03 Nov 2007 21:55:35 -0400 Original-Received: from tomts43.bellnexxia.net ([209.226.175.110] helo=tomts43-srv.bellnexxia.net) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1IoUi3-0002lC-Mr for emacs-pretest-bug@gnu.org; Sat, 03 Nov 2007 21:55:31 -0400 Original-Received: from ceviche.home ([74.12.208.82]) by tomts43-srv.bellnexxia.net (InterMail vM.5.01.06.13 201-253-122-130-113-20050324) with ESMTP id <20071104015530.QKUW26794.tomts43-srv.bellnexxia.net@ceviche.home> for ; Sat, 3 Nov 2007 21:55:30 -0400 Original-Received: by ceviche.home (Postfix, from userid 20848) id F02E0B40D7; Sat, 3 Nov 2007 21:55:29 -0400 (EDT) In-Reply-To: <472CB6AB.9020301@gmail.com> (Lennart Borgman's message of "Sat, 03 Nov 2007 18:58:03 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.50 (gnu/linux) X-detected-kernel: by monty-python.gnu.org: Solaris 8 (1) X-detected-kernel: by monty-python.gnu.org: Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:82477 gmane.emacs.pretest.bugs:20235 Archived-At: > Should not both this regexp give the same result here? It looks to me like * > is treated as *? - ie non-greedy. The regexp-matching is greedy, so it matches the longest match, but the regexp-search will return the leftmost (i.e. first) match, so mod-regx* will match at the very first position (matching the mprty string), whereas mod-regx+ will fail at that position so it will then succeed at the second position where both mod-regx+ and mod-regx* would match the same string. Stefan