jon.recoil.org

Module Re.PcreSource

NOTE: Only a subset of the PCRE spec is supported

Sourceexception Parse_error
Sourceexception Not_supported
Sourcetype regexp
Sourcetype flag = [
  1. | `CASELESS
  2. | `MULTILINE
  3. | `ANCHORED
  4. | `DOTALL
]
Sourcetype groups = Group.t
Sourcetype split_result =
  1. | Text of string
    (*

    Text part of splitted string

    *)
  2. | Delim of string
    (*

    Delimiter part of splitted string

    *)
  3. | Group of int * string
    (*

    Subgroup of matched delimiter (subgroup_nr, subgroup_str)

    *)
  4. | NoGroup
    (*

    Unmatched subgroup

    *)

Result of a Pcre.full_split

Sourceval re : ?flags:Re.Pcre.flag list -> string -> (Re__.Ast.cset, [ `Cased | `Uncased ]) Re__.Ast.gen

re ~flags s creates the regexp s using the pcre syntax.

Sourceval re_result : ?flags:Re.Pcre.flag list -> string -> ((Re__.Ast.cset, [ `Cased | `Uncased ]) Re__.Ast.gen, [ `Not_supported | `Parse_error ]) Stdlib.result
Sourceval regexp : ?flags:Re.Pcre.flag list -> string -> Re.Pcre.regexp

re ~flags s compiles the regexp s using the pcre syntax.

Sourceval extract : rex:Re.Pcre.regexp -> string -> string array

extract ~rex s executes rex on s and returns the matching groups.

Sourceval exec : rex:Re.Pcre.regexp -> ?pos:int -> string -> Re.Pcre.groups

Equivalent to Core.exec.

Sourceval get_substring : Re.Pcre.groups -> int -> string

Equivalent to Core.Group.get.

Sourceval names : Re.Pcre.regexp -> string array

Return the names of named groups.

Sourceval get_named_substring : Re.Pcre.regexp -> string -> Re.Pcre.groups -> string

Return the first matched named group, or raise Not_found. Prefer to use the non-raising version get_named_substring_opt

Sourceval get_named_substring_opt : Re.Pcre.regexp -> string -> Re.Pcre.groups -> string option

Return the first matched named group, or raise Not_found.

Sourceval get_substring_ofs : Re.Pcre.groups -> int -> int * int

Equivalent to Core.Group.offset.

Sourceval pmatch : rex:Re.Pcre.regexp -> string -> bool

Equivalent to Core.execp.

Sourceval substitute : rex:Re__.Compile.re -> subst:(string -> string) -> string -> string
Sourceval full_split : ?max:int -> rex:Re.Pcre.regexp -> string -> Re.Pcre.split_result list
Sourceval split : rex:Re.Pcre.regexp -> string -> string list
Sourceval quote : string -> string

Deprecated

Sourcetype substrings = Group.t