package re2

  1. Overview
  2. Docs
OCaml bindings for RE2, Google's regular expression library

Install

Dune Dependency

Authors

Maintainers

Sources

re2-v0.12.0.tar.gz
sha256=8966e3ceade876af6542af41efc350261e5b70c1cd6b42ad698b80e486bba14e
md5=fcf5dc32f1a325f135624f1a3676539e

doc/re2/Re2/Regex/Match/index.html

Module Regex.Match

type t

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

val sexp_of_t : t -> Ppx_sexp_conv_lib.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.