package mparser-pcre

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

A pluggable regular expression engine.

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

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