Hi Rjones, So, will we add dependency of ocaml-pcre in RHEL7.5 ? Just like the new bug you filed to add dependency of ocaml-camlp4 & ocaml-labltk ? -- Thanks & Best regards, Chen Xiang Hua Raycom office Beijing (NAY), Red Hat Inc. Red Hat Telephony: 86 10 62608040 internal extension: 8388040 Team: Virt QE IRC: xchen@#S1, #virt ----- Original Message -----
From: "Richard W.M. Jones" <rjones@redhat.com> To: libguestfs@redhat.com Sent: Tuesday, August 1, 2017 10:00:15 PM Subject: [Libguestfs] [PATCH 0/2] Add lightweight bindings for PCRE.
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.
_______________________________________________ Libguestfs mailing list Libguestfs@redhat.com https://www.redhat.com/mailman/listinfo/libguestfs