* [Caml-list] ocaml 3.08: camlp4 corrupts Pcre module strings (?)
@ 2004-08-17 19:52 Richard Jones
0 siblings, 0 replies; only message in thread
From: Richard Jones @ 2004-08-17 19:52 UTC (permalink / raw)
To: caml-list
This is with OCaml 3.08 from Debian ...
$ ocamlc -I +pcre pcre.cma test.ml -o test
$ ./test
num of subs = 11
$ ocamlc -pp "camlp4o" -I +pcre pcre.cma test.ml -o test
$ ./test
num of subs = 2
(Note that num of subs is different in the two cases).
The file 'test.ml' is attached below.
This is actually causes a major problem with our live servers at the
moment, and I've no idea exactly what the cause is.
Rich.
----------------------------------------------------------------------
let line_re = Pcre.regexp ~flags:[`EXTENDED] "
^
(\\d+\\.\\d+\\.\\d+\\.\\d+) # Inet addr.
\\s
([-\\w]+) # Identd username.
\\s
([-\\w]+) # Auth username.
\\s
\\[(.*?)\\] # Date (we parse this separately).
\\s
\"(.*?)\" # Query.
\\s
(-|\\d+) # Result code.
\\s
(-|\\d+) # Size.
\\s
\"(.*?)\" # Referer.
\\s
\"(.*?)\" # UA.
(?:\\s
(-|[\\w.]+))? # Clickstream
"
let line = "212.56.101.183 - - [27/Jan/2004:10:21:22 +0000] \"GET / HTTP/1.0\" 200 1676 \"-\" \"Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5) Gecko/20031215 Firebird/0.7\" 212.56.101.183.35281075198882802"
let subs = Pcre.exec ~rex:line_re line
let () =
prerr_endline ("num of subs = " ^ string_of_int (Pcre.num_of_subs subs))
----------------------------------------------------------------------
--
Richard Jones. http://www.annexia.org/ http://www.j-london.com/
Merjis Ltd. http://www.merjis.com/ - improving website return on investment
MONOLITH is an advanced framework for writing web applications in C, easier
than using Perl & Java, much faster and smaller, reusable widget-based arch,
database-backed, discussion, chat, calendaring:
http://www.annexia.org/freeware/monolith/
-------------------
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2004-08-17 19:52 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-08-17 19:52 [Caml-list] ocaml 3.08: camlp4 corrupts Pcre module strings (?) Richard Jones
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox