package re

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

Install

Dune Dependency

Authors

Maintainers

Sources

ocaml-re-1.5.0.tar.gz
sha256=53322f763a8d771a68f986c9c323cab7d3afa56873c3eefa528fb92b1b511dd3
md5=1e9bff3279648881be31e5ff96219f0a

doc/re.glob/Re_glob/index.html

Module Re_glob

Shell-style regular expressions

exception Parse_error
val glob : ?anchored:bool -> ?pathname:bool -> ?period:bool -> ?expand_braces:bool -> string -> Re.t

Implements the semantics of shells patterns. The returned regular expression is unanchored by default.

Character '*' matches any sequence of characters and character '?' matches a single character. A sequence '...' matches any one of the enclosed characters. A sequence '^...' or '!...' matches any character *but* the enclosed characters. A backslash escapes the following character. The last character of the string cannot be a backslash.

anchored controls whether the regular expression will only match entire strings. Defaults to false.

pathname: If this flag is set, match a slash in string only with a slash in pattern and not by an asterisk ('*') or a question mark ('?') metacharacter, nor by a bracket expression ('') containing a slash. Defaults to true.

period: If this flag is set, a leading period in string has to be matched exactly by a period in pattern. A period is considered to be leading if it is the first character in string, or if both pathname is set and the period immediately follows a slash. Defaults to true.

If expand_braces is true, braced sets will expand into multiple globs, e.g. ax,yb

,2

matches axb1, axb2, ayb1, ayb2. As specified for bash, brace expansion is purely textual and can be nested. Defaults to false.

val glob' : ?anchored:bool -> bool -> string -> Re.t

Same, but allows to choose whether dots at the beginning of a file name need to be explicitly matched (true) or not (false)

  • deprecated

    Use glob ~period.

val globx : ?anchored:bool -> string -> Re.t

This version of glob also recognizes the pattern {..,..}

  • deprecated

    Prefer glob ~expand_braces:true.

val globx' : ?anchored:bool -> bool -> string -> Re.t

This version of glob' also recognizes the pattern {..,..}

  • deprecated

    Prefer glob ~expand_braces:true ~period.

OCaml

Innovation. Community. Security.