Regexp

Regular Expression Backends

Unfortunately, there is a bit of confusion about the regular expression backend used by Ocamlnet. Traditionally, this was always PCRE, and not the Str library coming with the OCaml distribution. The reason was that Str did not have a thread-safe API, but it was required to make Ocamlnet thread-safe.

However, recent OCaml releases ship with a version of Str that can be easily made thread-safe. Because of this, the default regexp backend is now Str, with an option to use PCRE instead.

Current Solution

So we have now by default:

You can enable PCRE in the configure script with -enable-pcre or -enable-full-pcre. The effects are as follows:

The meanings of the configuration options are thus:

OPAM users: Note that the OPAM package for OCamlnet does not build with PCRE support by default. The trigger for this is the presence of the pcre OPAM package, i.e. do opam install pcre to include netstring-pcre in a rebuild.

Previous Solutions

Actually, Ocamlnet stepped away from PCRE in several phases.

Recommendations

For packagers of Ocamlnet, the recommendation is to build Ocamlnet with Str as default engine, and to offer PCRE as option (i.e. -enable-pcre). The latter allows it to easily port other software to the new Ocamlnet style.

It is discouraged to switch completely to PCRE (-enable-full-pcre).

For users of Ocamlnet, the recommendations are: