Some background: there is a regular expression module in the small stdlib OCaml ships with (the String module mentioned in the article). Unfortunately, it is terrible and full of global state. The ocaml-re package is interesting but really low-level. However, it has one interesting feature: it makes it possible to build regular expression in a composable, type-safe way. The humane-re package provides higher-level operations, though last time I checked didn't (yet) support substitution.