From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id 17F32BB81 for ; Wed, 22 Dec 2004 17:58:52 +0100 (CET) Received: from mail.davidb.org (adsl-64-172-240-129.dsl.sndg02.pacbell.net [64.172.240.129]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id iBMGwoe1023901 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Wed, 22 Dec 2004 17:58:51 +0100 Received: from davidb by mail.davidb.org with local (Exim 4.42 #1 (Debian)) id 1Ch9p0-0007yF-V9; Wed, 22 Dec 2004 08:58:46 -0800 Date: Wed, 22 Dec 2004 08:58:46 -0800 From: David Brown To: skaller Cc: William Lovas , caml-list@yquem.inria.fr Subject: Re: [Caml-list] Str.string_match incorrect Message-ID: <20041222165846.GA30503@old.davidb.org> References: <1103687369.6979.50.camel@pelican.wigram> <20041222074455.GA81342@trout> <20041222080009.GA4501@force.stwing.upenn.edu> <1103731044.6979.109.camel@pelican.wigram> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1103731044.6979.109.camel@pelican.wigram> User-Agent: Mutt/1.5.6i X-Miltered: at nez-perce with ID 41C9A7CA.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 caml-list:01 wrote:01 lovas:01 wrote:01 behaves:01 appending:01 expression:01 expression:01 partial:01 strings:01 strings:01 matched:01 matched:01 match:02 X-Spam-Checker-Version: SpamAssassin 3.0.0 (2004-09-13) on yquem.inria.fr X-Spam-Status: No, score=0.1 required=5.0 tests=FORGED_RCVD_HELO autolearn=disabled version=3.0.0 X-Spam-Level: On Thu, Dec 23, 2004 at 02:57:25AM +1100, skaller wrote: > On Wed, 2004-12-22 at 19:00, William Lovas wrote: > > On Tue, Dec 21, 2004 at 11:44:55PM -0800, Evan Martin wrote: > > > This is consistent with the docs, which say: > > > [string_match r s start] tests whether the characters in s starting at > > > position start match the regular expression r. > > > and in general with how regular expression systems work. > > Then they're simply wrong. The fundamental operation is > to check if a string is in a regular set of strings. > Plainly 'aa' is not in the set { 'a' }. This is a strange notion of right and wrong. The function behaves exactly as it is specified in the documentation. It is not difficult to append a '$' to the regular expression to only match the entire string. If the function only matched the entire string, yes, appending ".*" would cause it to match partial matches, but then it would be more difficult to extract the matched pattern out. Arguably, another function could be provided to always do full matching of strings, but I suspect it just isn't used all that much. Dave