jon.recoil.org

Module Re_pcreSource

include module type of struct include Re.Pcre end
exception Parse_error
exception Not_supported
type regexp
type flag = [
  1. | `CASELESS
  2. | `MULTILINE
  3. | `ANCHORED
  4. | `DOTALL
]
type groups = Re.Group.t
type split_result = Re.Pcre.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

val re : ?flags:Re_pcre.flag list -> string -> (Re__.Ast.cset, [ `Cased | `Uncased ]) Re__.Ast.gen @@ portable

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

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

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

val extract : rex:Re_pcre.regexp -> string -> string array @@ portable

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

val exec : rex:Re_pcre.regexp -> ?pos:int -> string -> Re_pcre.groups @@ portable

Equivalent to Core.exec.

val get_substring : Re_pcre.groups -> int -> string @@ portable

Equivalent to Core.Group.get.

val names : Re_pcre.regexp -> string array @@ portable

Return the names of named groups.

val get_named_substring : Re_pcre.regexp -> string -> Re_pcre.groups -> string @@ portable

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

val get_named_substring_opt : Re_pcre.regexp -> string -> Re_pcre.groups -> string option @@ portable

Return the first matched named group, or raise Not_found.

val get_substring_ofs : Re_pcre.groups -> int -> int * int @@ portable

Equivalent to Core.Group.offset.

val pmatch : rex:Re_pcre.regexp -> string -> bool @@ portable

Equivalent to Core.execp.

val substitute : rex:Re__.Compile.re -> subst:(string -> string) -> string -> string @@ portable
val full_split : ?max:int -> rex:Re_pcre.regexp -> string -> Re_pcre.split_result list @@ portable
val split : rex:Re_pcre.regexp -> string -> string list @@ portable
val quote : string -> string @@ portable

Deprecated

type substrings = Re.Group.t