pcre2-ocaml offers library functions for string pattern matching and substitution, similar to the functionality offered by the Perl language.

WWW: https://github.com/camlp5/pcre2-ocaml
