We'd like to use PCRE instead of the awful Str module. However I don't necessarily want to pull in the extra dependency of ocaml-pcre, and in any case ocaml-pcre is rather difficult to use. This introduces very simplified and lightweight bindings for PCRE. They work rather like Str in that there is some global state (actually thread-local in this implementation) between the matching and the getting the substring, so you can write code like this: let re = PCRE.compile "(a+)b" ... if PCRE.matches re "ccaaaabb" then ( let whole = PCRE.sub 0 in (* returns "aaaab" *) let first = PCRE.sub 1 in (* returns "aaaa" *) ... I also introduced the switch from Str -> PCRE in virt-builder to show that it simplifies code while allowing you to use the much more powerful PCRE regular expressions. Rich.