From: Richard Jones <rich@annexia.org>
To: caml-list@inria.fr
Subject: [Caml-list] ocaml 3.08: camlp4 corrupts Pcre module strings (?)
Date: Tue, 17 Aug 2004 20:52:12 +0100 [thread overview]
Message-ID: <20040817195212.GA16691@annexia.org> (raw)
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
reply other threads:[~2004-08-17 19:52 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20040817195212.GA16691@annexia.org \
--to=rich@annexia.org \
--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