package dune-private-libs

  1. Overview
  2. Docs

Manipulate matching groups.

Manipulate matching groups.

Manipulate matching groups.

type t

Information about groups in a match. As is conventional, every match implicitly has a group 0 that covers the whole match, and explicit groups are numbered from 1.

val get : t -> int -> string

Raise Not_found if the group did not match

val get_opt : t -> int -> string option

Similar to get, but returns an option instead of using an exception.

val offset : t -> int -> int * int

Raise Not_found if the group did not match

val start : t -> int -> int

Return the start of the match. Raise Not_found if the group did not match.

val stop : t -> int -> int

Return the end of the match. Raise Not_found if the group did not match.

val all : t -> string array

Return the empty string for each group which did not match

val all_offset : t -> (int * int) array

Return (-1,-1) for each group which did not match

val test : t -> int -> bool

Test whether a group matched

val nb_groups : t -> int

Returns the total number of groups defined - matched or not. This function is experimental.

val pp : Stdlib.Format.formatter -> t -> unit
OCaml

Innovation. Community. Security.