package re2

  1. Overview
  2. Docs

Module Re2.MultipleSource

Sourcetype 'a t

An efficient way to ask which of several regexes matches a string.

Sourceval create : ?options:Options.t -> (string * 'a) list -> 'a t Core.Or_error.t

create ?options [ (pattern1, value1); (pattern2, value2); ...] associates each pattern with its value. The same options are used for all patterns.

Sourceval create_exn : ?options:Options.t -> (string * 'a) list -> 'a t
Sourceval matches : 'a t -> string -> 'a list

matches t input returns the values associated with those patterns that match the input. Values are in the order that create saw them.

Sourceval matches_no_order : 'a t -> string -> 'a list

Like matches, but values are listed in unspecified order.

Expose the return values originally passed to create.

The following identity holds:

  [%equal: a list]
    (alist |> create_exn |> vals |> Array.Permissioned.to_list)
    (alist |> List.map ~f:snd)
OCaml

Innovation. Community. Security.