package tyre

  1. Overview
  2. Docs
Typed Regular Expressions

Install

dune-project
 Dependency

Authors

Maintainers

Sources

1.0.tar.gz
sha256=63ca1915da896640534b5cf928d220198709ec74b899d55b830fb0ceccebd633
sha512=536440d090046569449c7752315d568b3447e84c8c0e555a35a20a504a96a538ed9bc4e8e5f78e5860744ba863023331aa0a9893bf2028ae280cad678ec8d59c

doc/tyre/Tyre/Charset/index.html

Module Tyre.Charset

Sets of characters

Sets of characters support more operations than regular regexps, as you can diff them, so they have a specific type that allows these operations.

To convert to a regular Tyre.t, use charset or rep_charset

type t

A set of characters.

val not : t -> t

not s is any - s

val union : t list -> t
val inter : t list -> t
val diff : t -> t -> t

diff a b is the sets of chars that are in a but not in b

val compl : t list -> t

compl sets is not (union sets)

val (||) : t -> t -> t

a || b is union [a; b]

val (&&) : t -> t -> t

a && b is inter [a; b]

val (-) : t -> t -> t

a - b is diff a b

val char : char -> t

The singleton set

val range : char -> char -> t

range of characters ordered according to their code. Include both bounds.

val set : string -> t

any character in the string

Predefined character sets

In general, matches latin1 characters, thats is the ocaml Stdlib.char type.

The exact characters matched are not documented in Re, the documentation bellow was written using the source: https://ocaml.orange/p/re/latest/doc/src/re/cset.ml.html .

val any : t

any character including newline

val notnl : t

any character except a new line

val wordc : t

wordc is the union of alnum and char '_'

val alpha : t

aplha is the union of lower, upper and set "\170\186"

val alnum : t

alnum is the uninon of alpha and digit

val ascii : t

chars with code 0 to 127, bounds included

val blank : t

blank is a space ' ' or a tab \t.

val cntrl : t

control characters. union of range '\000' '\031' and rg '\127' '\159'.

val digit : t

digit is set "0123456789"

val graph : t

union of range '\033' '\126' and range '\160' '\255'

val lower : t

lower is lowercase latin1 letter.

Includes range 'a' 'z', char 'µ', range '\223' '\246' = set "ßàáâãäåæçèéêëìíîïðñòóôõö" and range '\248' '\255' = set "øùúûüýþÿ"

val print : t

printable latin1 characters. range '\032' '\126' || range '\160' '\255'

val punct : t

latin1 ponctuation.

set "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~\160¡¢£¤¥¦§¨©«¬\173®¯°±²³´¶·¸¹»¼½¾¿×÷"
val space : t

space is set " \t\n\013"

val upper : t

upper is latin1 uppercase letter. This includes ascii uppercase letters, that is range 'A' 'Z', but also the ranges range '\192' '\214' = set "ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ" and range '\216' '\222' = set "ØÙÚÛÜÝÞ"

val xdigit : t

hexadecimal digit. range '0' '9' || range 'a' 'f' || range 'A' 'F'