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
[Caml-list] Regexp libraries
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2002-02-13 (21:55)
From: Jerome Vouillon <jerome.vouillon@i...>
Subject: Re: [Caml-list] Regexp libraries
On Sun, Feb 10, 2002 at 01:00:18AM -0800, Francois Rouaix wrote:
> I'm cleaning up some old code of mine that uses regexps quite heavily...
> Since those days where we only had Str, it seems that I now have the
> choice between at least Pcre and Libre. Would anyone care to give their
> opinion on those ? I'd like to get rid of Str because of the threads
> issues (and bugs with large input). I've used Pcre a bit, but would like
> to go to an all-Ocaml solution because of Win2k porting requirements.
> However, the Libre documentation is inexistant (the .mli files contains
> barely more than the types).

Here is a list of disavantages and advantages of RE compared to Pcre.

- The pattern compilation is more costly
- Not fully thread safe (you cannot simultaneously use the same
  pattern in different threads)
- Slower than Pcre when compiled to bytecode
- Lot of missing features : back-references, look-ahead and
  look-behind assertions, ...

- Choice between different matching semantics
  (first match, longuest match, shortest match)
- Regular expression can be combined using operators such as union or
- Much faster than Pcre once start-up time is amortized
- All regular expression are executed at the same speed once start-up
  time is amortized, so you don't have to do any performance tweaking.

> Would somebody on the list, that has knowledge of the library (Jerome
> ?), be willing to enhance the Libre docs a tiny bit ?

I should really take the time to write a documentation.  But I don't
have the time at the moment...

Patrick Doane has contributed a pretty large test suite (located in
tests/test_*.ml).  This test suite may help you understand the library.

-- Jerome
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr