Browse thread
About the O'Reilly book on the web
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: | 2006-11-27 (09:07) |
From: | Sebastien Ferre <ferre@i...> |
Subject: | Re: [Caml-list] About the O'Reilly book on the web |
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