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 LAA27709; Tue, 14 Sep 2004 11:42:09 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id LAA28295 for ; Tue, 14 Sep 2004 11:42:08 +0200 (MET DST) Received: from smtp-2.syd.swiftdsl.com.au (smtp-2.syd.swiftdsl.com.au [218.214.224.98]) by nez-perce.inria.fr (8.13.0/8.13.0) with SMTP id i8E9g5Gp020465 for ; Tue, 14 Sep 2004 11:42:07 +0200 Received: (qmail 23332 invoked from network); 14 Sep 2004 09:42:18 -0000 Received: from unknown (HELO coltrane.mega-nerd.net) (218.214.64.136) by smtp-2.syd.swiftdsl.com.au with SMTP; 14 Sep 2004 09:42:18 -0000 Received: from coltrane (localhost [127.0.0.1]) by coltrane.mega-nerd.net (Postfix) with SMTP id A79D77B88 for ; Tue, 14 Sep 2004 19:42:02 +1000 (EST) Date: Tue, 14 Sep 2004 19:42:02 +1000 From: Erik de Castro Lopo To: caml-list@inria.fr Subject: Re: [Caml-list] Str broken Message-Id: <20040914194202.6aeb3124.ocaml-erikd@mega-nerd.com> In-Reply-To: <1095154018.27775.896.camel@pelican.wigram> References: <1095154018.27775.896.camel@pelican.wigram> Organization: Erik Conspiracy Secret Labs X-Mailer: Sylpheed version 0.9.12 (GTK+ 1.2.10; i386-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Miltered: at nez-perce with ID 4146BCEE.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 2004:99 sourceforge:01 bug:01 2004:99 3.07:01 endline:01 endline:01 debugging:01 regexp:01 regexp:01 debug:01 ocaml:01 caml:01 dragon:98 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On 14 Sep 2004 19:26:59 +1000 skaller wrote: > The Str module seems not to work: > > open Str;; > let re = "(a\\|b)*abb" > let cre = regexp re > let s = "ababababb" > ;; > string_match cre s 0 > ;; > > returns false. This is the classic test from the Dragon book. > Before I post a bug report can someone confirm this result please? > I'm using: Objective Caml version 3.09+dev0 (2004-07-13) I'm using 3.07+2 here. The code you posted produced a warning for me. It seems that for ocaml some extra escaping is required in comparison with other languages. Fixing this code: open Str ;; let re = "\\(a\\|b\\)*abb" ;; let cre = regexp re ;; let s = "ababababb" ;; if string_match cre s 0 then print_endline "true" else print_endline "false" ;; prints "true" for me. Cheers, Erik -- +-----------------------------------------------------------+ Erik de Castro Lopo nospam@mega-nerd.com (Yes it's valid) +-----------------------------------------------------------+ "Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." --Brian Kernighan ------------------- 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