caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Philippe Wang <lists@philippewang.info>
To: caml-list@inria.fr
Subject: Re: [Caml-list] About the O'Reilly book on the web
Date: Tue, 28 Nov 2006 22:01:43 +0100	[thread overview]
Message-ID: <456CA3B7.1020508@philippewang.info> (raw)
In-Reply-To: <456AAABE.5020405@irisa.fr>

Hello,

If you look closer, you can see that the book is about the version 2.04.

http://caml.inria.fr/pub/docs/oreilly-book/html/book-ora009.html

With OCaml 2.04, you don't have those warnings because they hadn't 
appeared yet.

         Objective Caml version 2.04

# "[0-9]+\.[0-9]+\.[0-9]+";;
- : string = "[0-9]+\\.[0-9]+\\.[0-9]+"

You can probably avoid warnings by backslashing your backslashes...

Still I believe the OCaml Team should find another way to express 
regular expressions, because if \. and \\. both mean \\. then it is a 
very bad idea...

Well, enjoy OCaml :-)

-- 
Philippe Wang
   mail@philippewang.info


PS : I hardly understand what I'm supposed to do to post in this 
mailing-list, so you have probably not received this one before, but 
maybe you already have...
(I hope this time it'll work...)


Sebastien Ferre a écrit :
> 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
> 
> _______________________________________________
> Caml-list mailing list. Subscription management:
> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> Archives: http://caml.inria.fr
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs


  reply	other threads:[~2006-11-28 21:04 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-25 18:38 Francois Colonna
2006-11-27  9:07 ` [Caml-list] " Sebastien Ferre
2006-11-28 21:01   ` Philippe Wang [this message]
2006-11-28 22:33     ` Till Varoquaux
2006-11-28 22:47       ` Martin Jambon
2006-11-29  0:18         ` Philippe Wang
2006-11-29  1:48           ` Martin Jambon
2006-11-29 15:26             ` Philippe Wang
2006-11-29 17:52             ` Diego Olivier FERNANDEZ PONS
2006-11-29 17:25           ` brogoff
2006-11-29 18:10             ` Philippe Wang
2006-11-30  2:30               ` skaller
2006-11-30 18:20                 ` Tom
2006-12-01  3:21                   ` skaller
2006-12-01  6:48                     ` Tom
2006-11-29 21:20             ` Jon Harrop
2006-11-29 21:25               ` Till Varoquaux
2006-12-01  0:12               ` brogoff
2006-11-28 23:07       ` Philippe Wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=456CA3B7.1020508@philippewang.info \
    --to=lists@philippewang.info \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).