From xemacs-m  Thu Aug 21 09:55:11 1997
Received: from server.sensei.co.uk (server.sensei.co.uk [193.132.124.5])
	by xemacs.org (8.8.5/8.8.5) with ESMTP id JAA09854
	for <xemacs-beta@xemacs.org>; Thu, 21 Aug 1997 09:55:10 -0500 (CDT)
Received: from planet.sensei.co.uk (root@planet.sensei.co.uk [195.92.19.3]) by server.sensei.co.uk (8.8.5/8.8.2) with ESMTP id PAA09038 for <xemacs-beta@xemacs.org>; Thu, 21 Aug 1997 15:54:43 +0100
Received: from cerise.sensei.co.uk (glynn@muvies.demon.co.uk [158.152.66.14]) by planet.sensei.co.uk (8.8.2/8.8.2) with ESMTP id PAA15894 for <xemacs-beta@xemacs.org>; Thu, 21 Aug 1997 15:53:51 +0100
Received: (from glynn@localhost) by cerise.sensei.co.uk (8.8.5/8.8.2) id PAA00919; Thu, 21 Aug 1997 15:42:50 +0100
Date: Thu, 21 Aug 1997 15:42:50 +0100
Message-Id: <199708211442.PAA00919@cerise.sensei.co.uk>
From: Glynn Clements <glynn@sensei.co.uk>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
To: xemacs-beta@xemacs.org
Subject: Re: New regex syntax
In-Reply-To: <199708201707.NAA25055@biohazard-cafe.MIT.EDU>
References: <87lo21hzm0.fsf@bittersweet.inetarena.com>
	<vwmd8n8n9up.fsf@calico.cis.ohio-state.edu>
	<199708201601.RAA01648@cerise.sensei.co.uk>
	<vwmaficn86j.fsf_-_@calico.cis.ohio-state.edu>
	<199708201650.RAA01802@cerise.sensei.co.uk>
	<199708201707.NAA25055@biohazard-cafe.MIT.EDU>
X-Mailer: VM 6.33 under 20.3 "Bratislava" XEmacs  Lucid (beta18)


David Bakhash wrote:

> Glynn Clements writes:
>  > Consider matching against XYZYZ
>  > 
>  > 	X.*Z	==> XYZYZ
>  > 	X.*?Z	==> XYZ
>  > 
>  > Without *? you would have to use X[^Z]*Z instead. Not in itself a big
>  > deal, but if the trailing regex is more complex, then the advantages
>  > become much more significant.
> 
> AFAIK, this is only true if you're using the posix REs.  in the example
> above, can you really be guaranteed that X.*Z won't match XYZ using the
> standard emacs RE facilities?

Yes. * performs `maximal matching', i.e. it matches the maximum
possible number of occurrences of the preceding regexp. At least
that's what the info says.

	(progn
	  (string-match "X.*Z" "XYZYZ")
	  (match-end 0))
	5

-- 
Glynn Clements <glynn@sensei.co.uk>

