@@ -56,9 +56,9 @@ type re_term =
5656(* *********************************************************************)
5757(* Final types *)
5858
59- type regexp = Pcre .regexp
59+ type regexp = Pcre2 .regexp
6060type split_result = Str .split_result = Text of string | Delim of string
61- type result = Pcre .substrings
61+ type result = Pcre2 .substrings
6262
6363(* *********************************************************************)
6464(* Parse Str-style regexps, and convert to Pcre-style regexps *)
@@ -268,9 +268,9 @@ let pcre_safe_quote c =
268268
269269let rec print_pcre_regexp ret =
270270 match ret with
271- | Texact s -> Pcre . quote s
271+ | Texact s -> Pcre2 . quote s
272272 | Tnullchar ->
273- (* Pcre .quote "\000" returns nonsense *)
273+ (* Pcre2 .quote "\000" returns nonsense *)
274274 " [\\ 000]"
275275 | Tany -> " ."
276276 | Tnull -> " (?:)"
@@ -315,42 +315,42 @@ and print_set s =
315315let regexp s =
316316 let ret = scan_str_regexp s in
317317 let s' = print_pcre_regexp ret in
318- Pcre . regexp ~flags: [ `MULTILINE ] s'
318+ Pcre2 . regexp ~flags: [ `MULTILINE ] s'
319319
320320let search_forward pat s pos =
321- let result = Pcre . exec ~rex: pat ~pos s in
322- (fst (Pcre . get_substring_ofs result 0 ), result)
321+ let result = Pcre2 . exec ~rex: pat ~pos s in
322+ (fst (Pcre2 . get_substring_ofs result 0 ), result)
323323
324324let matched_string result _ =
325- (* Unfortunately, Pcre .get_substring will not raise Not_found if there is
325+ (* Unfortunately, Pcre2 .get_substring will not raise Not_found if there is
326326 * no matched string. Instead, it returns "", but this value cannot be
327327 * distinguished from an empty match.
328- * The workaround is to call Pcre .get_substring_ofs first. This function
328+ * The workaround is to call Pcre2 .get_substring_ofs first. This function
329329 * will raise Not_found if there is not any matched string.
330330 *
331331 * NOTE: Current versions of Pcre do return Not_found!
332332 *)
333- ignore (Pcre . get_substring_ofs result 0 );
334- Pcre . get_substring result 0
333+ ignore (Pcre2 . get_substring_ofs result 0 );
334+ Pcre2 . get_substring result 0
335335
336- let match_beginning result = fst (Pcre . get_substring_ofs result 0 )
337- let match_end result = snd (Pcre . get_substring_ofs result 0 )
336+ let match_beginning result = fst (Pcre2 . get_substring_ofs result 0 )
337+ let match_end result = snd (Pcre2 . get_substring_ofs result 0 )
338338
339339let matched_group result n _ =
340340 (* See also the comment for [matched_string] *)
341- if n < 0 || n > = Pcre . num_of_subs result then raise Not_found ;
342- ignore (Pcre . get_substring_ofs result n);
343- Pcre . get_substring result n
341+ if n < 0 || n > = Pcre2 . num_of_subs result then raise Not_found ;
342+ ignore (Pcre2 . get_substring_ofs result n);
343+ Pcre2 . get_substring result n
344344
345345let global_substitute pat subst s =
346- Pcre . substitute_substrings ~rex: pat ~subst: (fun r -> subst r s) s
346+ Pcre2 . substitute_substrings ~rex: pat ~subst: (fun r -> subst r s) s
347347
348348let tr_split_result r =
349349 List. map
350350 (function
351- | Pcre .Text t -> Text t | Pcre .Delim d -> Delim d | _ -> assert false )
351+ | Pcre2 .Text t -> Text t | Pcre2 .Delim d -> Delim d | _ -> assert false )
352352 (List. filter
353- (function Pcre .Group (_ , _ ) | Pcre .NoGroup -> false | _ -> true )
353+ (function Pcre2 .Group (_ , _ ) | Pcre2 .NoGroup -> false | _ -> true )
354354 r)
355355
356- let full_split sep s = tr_split_result (Pcre . full_split ~rex: sep ~max: (- 1 ) s)
356+ let full_split sep s = tr_split_result (Pcre2 . full_split ~rex: sep ~max: (- 1 ) s)
0 commit comments