package re2

  1. Overview
  2. Docs
type t

A Match.t is the result of applying a regex to an input string

include sig ... end
val sexp_of_t : t -> Sexplib.Sexp.t
val get : sub:id_t -> t -> string option

If location information has been omitted (e.g., via ~sub), the error returned is Regex_no_such_subpattern, just as though that subpattern were never defined.

val get_exn : sub:id_t -> t -> string
val get_all : t without_trailing_none -> string option array

get_all t returns all available matches as strings in an array. For the indexing convention, see comment above regarding sub parameter. *

val get_pos_exn : sub:id_t -> t -> int * int

get_pos_exn ~sub t returns the start offset and length in bytes. Note that for variable-width encodings (e.g., UTF-8) this may not be the same as the character offset and character length.

OCaml

Innovation. Community. Security.