From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id 484F2BCE8 for ; Mon, 27 Nov 2006 10:07:13 +0100 (CET) Received: from smtp.irisa.fr (smtp.irisa.fr [131.254.254.26]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id kAR97Cr7008787 for ; Mon, 27 Nov 2006 10:07:13 +0100 Received: from localhost (localhost.localdomain [127.0.0.1]) by localhost.irisa.fr (Postfix) with ESMTP id CBD9CFA98; Mon, 27 Nov 2006 10:07:12 +0100 (CET) Received: from smtp.irisa.fr ([131.254.254.26]) by localhost (meli.irisa.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 23614-02; Mon, 27 Nov 2006 10:07:10 +0100 (CET) Received: from [131.254.10.144] (polaris.irisa.fr [131.254.10.144]) by smtp.irisa.fr (Postfix) with ESMTP id B3B22FA82; Mon, 27 Nov 2006 10:07:10 +0100 (CET) Message-ID: <456AAABE.5020405@irisa.fr> Date: Mon, 27 Nov 2006 10:07:10 +0100 From: Sebastien Ferre Organization: IRISA User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.2) Gecko/20040803 X-Accept-Language: en-us, en MIME-Version: 1.0 To: caml-list@yquem.inria.fr Cc: colonna@ccr.jussieu.fr Subject: Re: [Caml-list] About the O'Reilly book on the web References: <45688DAE.7010309@ccr.jussieu.fr> In-Reply-To: <45688DAE.7010309@ccr.jussieu.fr> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at irisa.fr X-Miltered: at discorde with ID 456AAAC0.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; irisa:01 o'reilly:01 o'reilly:01 oreilly-book:01 followin:01 regexp:01 backslash:01 regexp:01 groupings:98 wrote:01 caml-list:01 expression:01 expression:01 strings:01 strings:01 Hello, Francois Colonna wrote: > Hello > > in the version of the O'Reilly book on the web > http://caml.inria.fr/pub/docs/oreilly-book/html/book-ora105.html#toc134 > > Chapter 11 about Str Library page 293 > > the followin example of a regular expression is given : > > *let*| |english_date_format| ||=|| |Str.regexp| > ||"[0-9]+\.[0-9]+\.[0-9]+"|| |;; There should be a double backslash \\. Indeed \ is a meta-chararcter of regular expressions, but also of usual strings. In general, all backslashes in regular expressions must be doubled when represented as caml strings. For instance, the same happens with groupings : the regular expression : \([0-9]+\),\1 is represented by let re = Str.regexp "\\([0-9]+\\),\\1" Hope it helps, Sebastien