English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
ANNOUNCE: LablPCRE 0.9 - a PCRE binding for Objective Caml
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2005-12-29 (20:43)
From: Robert Roessler <roessler@r...>
Subject: Re: [Caml-list] ANNOUNCE: LablPCRE 0.9 - a PCRE binding for Objective Caml
N. Owen Gunden wrote:
> On Thu, Dec 22, 2005 at 09:42:30PM -0800, Robert Roessler wrote:
>> The second public release of the LablPCRE OCaml binding for PCRE is 
>> now available, featuring a new "module" interface with expanded 
>> functionality and supporting PCRE releases 6.1 - 6.4 (current).
> What is the advantage of your PCRE bindings over Markus Mottl's
> pcre-ocaml?  How do they differ?

At the time (mid-June 2005), Markus' package would not build properly 
on Windows... he invited me to contribute a fix, and in good open 
source style, I built my own. ;)

As I was already familiar with PCRE in its "POSIX" interface guise, I 
was looking for a relatively simple interface... I found the sheer 
comprehensiveness of Markus' binding (giving access to *all* of PCRE) 
daunting.  So, deciding that others with modest pattern-matching needs 
might also appreciate a simpler interface, I built LablPCRE (certainly 
not as a replacement, but as a small-footprint alternative).

There are really only three "major" functions in LablPCRE: regcomp to 
compile REs, regexec to test them against input, and regmatch when all 
that is needed is a simple match/nomatch query (this last is my own 
low-resource-consumption addition - it is not included in the POSIX API).

In addition, of course, there are a handful of functions for accessing 
the match state, errors, and/or any captured substrings from a regexec 
invocation.  Some effort is made to make a Pcre.t value as light as 
possible, e.g., a reference to the tested string will only be kept if 
the match succeeded *and* substring capture was requested.

The original release made the above (minus regmatch) available in an 
"object" form... subsequent experience with OCaml vernacular and idiom 
suggested that a "module" interface was superior, so the current 
release has been re-oriented to that style (with the original object 
interface still available).

> Is there API documentation for your library on the web somewhere?

Yes - in the LablPCRE-0.9.tar.gz file on the download site. :)

As seems to be somewhat common in the OCaml world, there is a 
commented .mli file, and a README.txt with more in-depth discussions 
and examples.

Robert Roessler