From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 67FE4BB81 for ; Wed, 22 Dec 2004 09:01:26 +0100 (CET) Received: from nexus.stwing.upenn.edu (NEXUS.STWING.UPENN.EDU [165.123.132.61]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id iBM81ODm012702 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL) for ; Wed, 22 Dec 2004 09:01:26 +0100 Received: from force.stwing.upenn.edu (force.stwing.upenn.edu [165.123.132.65]) by nexus.stwing.upenn.edu (8.12.10/8.12.9) with ESMTP id iBM81NHA028938 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL) for ; Wed, 22 Dec 2004 03:01:23 -0500 (EST) Received: from force.stwing.upenn.edu (localhost [127.0.0.1]) by force.stwing.upenn.edu (8.12.10/8.12.9) with ESMTP id iBM81Mh4012924 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Wed, 22 Dec 2004 03:01:22 -0500 (EST) Received: (from wlovas@localhost) by force.stwing.upenn.edu (8.12.10/8.12.9/Submit) id iBM81LjB007719 for caml-list@yquem.inria.fr; Wed, 22 Dec 2004 03:01:22 -0500 (EST) Date: Wed, 22 Dec 2004 03:00:10 -0500 From: William Lovas To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Str.string_match incorrect Message-ID: <20041222080009.GA4501@force.stwing.upenn.edu> Mail-Followup-To: caml-list@yquem.inria.fr References: <1103687369.6979.50.camel@pelican.wigram> <20041222074455.GA81342@trout> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20041222074455.GA81342@trout> User-Agent: Mutt/1.5.4i X-Miltered: at concorde with ID 41C929D4.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; lovas:01 wlovas:01 stwing:01 upenn:01 caml-list:01 wrote:01 corresponds:01 debatable:01 semantics:01 regexp:01 bool:01 regexp:01 bool:01 cheers:01 ...:98 X-Spam-Checker-Version: SpamAssassin 3.0.0 (2004-09-13) on yquem.inria.fr X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.0 X-Spam-Level: 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. string_match > corresponds to running your automaton directly and seeing whether you > end up in an accept state, while string_partial_match effectively adds > an extra ".*" to the beginning. > (It's more debatable whether this makes sense.) I concur with your assessment, but i think you're characterization of the semantics of string_partial_match is inaccurate: # Str.string_match (Str.regexp "ab") "a" 0;; - : bool = false # Str.string_partial_match (Str.regexp "ab") "a" 0;; - : bool = true # Str.string_match (Str.regexp ".*ab") "a" 0;; - : bool = false ... unless of course, i've misunderstood you. I don't think there's a simple transformation on regular expressions that allow you to emulate string_partial_match's behavior using only string_match. (Does anyone care to prove me wrong? :) cheers, William