package mparser

  1. Overview
  2. Docs
type t

A compiled regular expression.

type substrings

Substrings matched by a regular expression.

val make : string -> t

Compiles a regular expression.

val get_substring : substrings -> int -> string option

Extracts a single substring. Returns None if the group did not match.

val get_all_substrings : substrings -> string array

Extracts all the matched substrings. Includes the full match at index 0. If a subpattern did not capture a substring, the empty string is returned in the corresponding position instead.

val exec : rex:t -> pos:int -> Bytes.t -> substrings option

Attemts to match the byte-buffer with a regular expression, starting from the position pos. Returns the matched substrings or None on failure.

OCaml

Innovation. Community. Security.