Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] ANNOUNCE: mod_caml 1.0.6 - includes security patch
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Markus Mottl <markus@o...>
Subject: Re: [Caml-list] ANNOUNCE: mod_caml 1.0.6 - includes security patch
On Thu, 15 Jan 2004, Richard Jones wrote:
> On Thu, Jan 15, 2004 at 04:04:33PM +0100, Frederic van der Plancke wrote:
> > > +  let re2 = Pcre.regexp "\\\\" in      (* Double up any backslashes. *)
> > > +  let sub2 = Pcre.subst "\\\\" in
> > 
> > This does not look right: why sub2 = re2 and not sub2 = re2 ^ re2 ?
> 
> No, it seems to be right.
> 
> PCRE doesn't using \ escaping in substitutions, only in regular
> expressions.  So the re2 matches \ and sub2 substitutes \\.

Richard is right here: I know it looks awful, but the four backslashes
in the regexp pattern for re2 indeed only stand for one. They
have to be escaped in the OCaml-string and also for PCRE again,
i.e. twice. Substitution patterns use the $-sign for escaping - therefore
escaping only needs to be done once.

Regards,
Markus

-- 
Markus Mottl          http://www.oefai.at/~markus          markus@oefai.at

-------------------
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