From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andreas Schwab Newsgroups: gmane.emacs.devel,gmane.emacs.pretest.bugs Subject: Re: Should not * be greedy in a regexp? Date: Sat, 03 Nov 2007 19:54:37 +0100 Message-ID: References: <472CB6AB.9020301@gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1194116104 10883 80.91.229.12 (3 Nov 2007 18:55:04 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 3 Nov 2007 18:55:04 +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 Sat Nov 03 19:55:05 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 1IoO9A-0002Hb-SK for ged-emacs-devel@m.gmane.org; Sat, 03 Nov 2007 19:55:05 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IoO90-0004PA-K3 for ged-emacs-devel@m.gmane.org; Sat, 03 Nov 2007 14:54:54 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IoO8x-0004N7-F7 for emacs-devel@gnu.org; Sat, 03 Nov 2007 14:54:51 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IoO8v-0004Kd-Q2 for emacs-devel@gnu.org; Sat, 03 Nov 2007 14:54:51 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IoO8v-0004KU-LB for emacs-devel@gnu.org; Sat, 03 Nov 2007 14:54:49 -0400 Original-Received: from fencepost.gnu.org ([140.186.70.10]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1IoO8u-0003aQ-U3 for emacs-devel@gnu.org; Sat, 03 Nov 2007 14:54:49 -0400 Original-Received: from mx10.gnu.org ([199.232.76.166]) by fencepost.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1IoO8t-0006W9-JA for emacs-pretest-bug@gnu.org; Sat, 03 Nov 2007 14:54:47 -0400 Original-Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1IoO8m-0003XT-W3 for emacs-pretest-bug@gnu.org; Sat, 03 Nov 2007 14:54:45 -0400 Original-Received: from cantor2.suse.de ([195.135.220.15] helo=mx2.suse.de) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1IoO8l-0003Wa-U5 for emacs-pretest-bug@gnu.org; Sat, 03 Nov 2007 14:54:40 -0400 Original-Received: from Relay1.suse.de (mail2.suse.de [195.135.221.8]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.suse.de (Postfix) with ESMTP id C7BF622FEB; Sat, 3 Nov 2007 19:54:37 +0100 (CET) X-Yow: Did an Italian CRANE OPERATOR just experience uninhibited sensations in a MALIBU HOT TUB? In-Reply-To: (Andreas Schwab's message of "Sat\, 03 Nov 2007 19\:48\:29 +0100") User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.1 (gnu/linux) X-detected-kernel: by monty-python.gnu.org: Linux 2.4-2.6 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:82440 gmane.emacs.pretest.bugs:20232 Archived-At: Andreas Schwab writes: > "Lennart Borgman (gmail)" writes: > >> Starting from >> >> emacs -Q >> >> Put this in the *scratch* buffer and eval it: >> >> (let* ((mod-regx+ "\\(\\(?:[CSM]-\\)+\\)") >> (mod-regx* "\\(\\(?:[CSM]-\\)*\\)") >> (str "") >> (m+ (when (string-match mod-regx+ str) >> (match-string 0 str))) >> (m* (when (string-match mod-regx* str) >> (match-string 0 str)))) >> (lwarn 't :warning "m+=3D%s, m*=3D%s" m+ m*)) >> >> I get >> >> Warning (t): m+=3DC-S-, m*=3D >> >> Should not both this regexp give the same result here? It looks to me = like >> * is treated as *? - ie non-greedy. > > The regexp matches the empty string. ... at the start of the string, I wanted to add. Andreas. --=20 Andreas Schwab, SuSE Labs, schwab@suse.de SuSE Linux Products GmbH, Maxfeldstra=DFe 5, 90409 N=FCrnberg, Germany PGP key fingerprint =3D 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED= 5 "And now for something completely different."