From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id TAA31784; Thu, 19 Aug 2004 19:24:19 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id TAA32739 for ; Thu, 19 Aug 2004 19:24:18 +0200 (MET DST) Received: from frontend1.messagingengine.com (frontend1.messagingengine.com [66.111.4.30]) by concorde.inria.fr (8.12.10/8.12.10) with ESMTP id i7JHOHRM028398 for ; Thu, 19 Aug 2004 19:24:18 +0200 X-Sasl-enc: vzJBZXNUcXGwCsRApyvz6Q 1092936255 Received: from [192.168.1.100] (unknown [218.81.126.52]) by frontend1.messagingengine.com (Postfix) with ESMTP id AA661C14A6F for ; Thu, 19 Aug 2004 13:24:14 -0400 (EDT) Date: Fri, 20 Aug 2004 01:24:02 +0800 (HKT) From: Martin Jambon X-X-Sender: martin@localhost To: caml-list@inria.fr Subject: [Caml-list] Match order of Str regexps Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Miltered: at concorde with ID 4124E241.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; regexps:01 regexps:01 syntax:02 match:02 match:02 greedy:97 jambon:02 jambon:02 string:03 string:03 library:03 str:05 str:05 ocamllex:05 longest:06 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Hello, Would it be possible to consider that: 1. the regular expressions in the Str library are matched in a greedy fashion (longest match, left to right), 2. that the regexps of an alternative are tried from left to right? Illustration of case 1 (micmatch/ocamllex syntax): # match "abc" with RE (_* as s1) (_* as s2) -> (s1, s2);; - : string * string = ("abc", "") Illustration of case 2: # match "ab" with RE "a" | "ab" as s -> s;; - : string = "a" Martin ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners