package re

  1. Overview
  2. Docs
RE is a regular expression library for OCaml

Install

dune-project
 Dependency

Authors

Maintainers

Sources

re-1.12.0.tbz
sha256=a01f2bf22f72c2f4ababd8d3e7635e35c1bf6bc5a41ad6d5a007454ddabad1d4
sha512=f0726826e1e677f7ecdf447d46d814a11d3844ec6e5c0527be8c73c7afdb08aacfca47ea764eda325bcd7064aff07c1d3441c935ee5a0fc99ede8707f81a451d

doc/re.pcre/Re_pcre/index.html

Module Re_pcre

  • deprecated Use Re.Pcre
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:flag list -> string -> (Re__.Ast.cset, [ `Cased | `Uncased ]) Re__.Ast.gen

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

val regexp : ?flags:flag list -> string -> regexp

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

val extract : rex:regexp -> string -> string array

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

val exec : rex:regexp -> ?pos:int -> string -> groups

Equivalent to Core.exec.

val get_substring : groups -> int -> string

Equivalent to Core.Group.get.

val names : regexp -> string array

Return the names of named groups.

val get_named_substring : regexp -> string -> groups -> string

Return the first matched named group, or raise Not_found.

val get_substring_ofs : groups -> int -> int * int

Equivalent to Core.Group.offset.

val pmatch : rex:regexp -> string -> bool

Equivalent to Core.execp.

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

Deprecated

type substrings = Re.Group.t