package re2

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

Install

Dune Dependency

Authors

Maintainers

Sources

v0.17.0.tar.gz
sha256=cde2fdedcf38297afb77dafbad3ca2eacee8ac70f84e84e05e88cf32bb1fb0bd

doc/re2/Re2/Match/index.html

Module Re2.MatchSource

Sourcetype t

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

Sourceval sexp_of_t : t -> Sexplib0.Sexp.t
Sourceval get : sub:[ `Index of int | `Name of string ] -> 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.

Sourceval get_exn : sub:[ `Index of int | `Name of string ] -> t -> string
Sourceval get_all : t Re2__.Regex.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.

Sourceval get_pos_exn : sub:[ `Index of int | `Name of string ] -> 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.