package quickjs

  1. Overview
  2. Docs
Bindings for QuickJS (a Javascript Engine to be embedded https://bellard.org/quickjs)

Install

dune-project
 Dependency

Authors

Maintainers

Sources

quickjs-0.4.2.tbz
sha256=594fac60b9273af7e1903f0689efa353121309d8de911376f91966c32cd3ab7f
sha512=68beb126919a214fa9e46d84566c97e6ff3667c6c4478f352f1145e5bf1888b2a5eaca9855f39d734b2e9dc5bc0c7650f45679d177d546a2b0ba53dced5f2d1f

doc/quickjs/Quickjs/RegExp/index.html

Module Quickjs.RegExpSource

Sourcetype t

The RegExp object

Sourcetype result

The result of a executing a RegExp on a string

Sourcetype compile_error = [
  1. | `Unexpected_end
  2. | `Malformed_unicode_char
  3. | `Invalid_escape_sequence
  4. | `Nothing_to_repeat
  5. | `Unknown of string
]

Possible errors when compiling a RegExp pattern

Sourceval compile_error_to_string : compile_error -> string

Convert a compile error to a human-readable string

Sourceval compile : flags:string -> string -> (t, compile_error) result

Constructs a RegExp.t from a string describing a regex and their flags. Returns Error (error_type, raw_message) if compilation fails.

Sourceval last_index : t -> int

returns the index where the next match will start its search

Sourceval set_last_index : t -> int -> unit

sets the index at which the next match (RegExp.exec or RegExp.test) will start its search from

Sourceval flags : t -> string

returns the enabled flags as a string

Sourceval global : t -> bool

returns a bool indicating whether the global flag (g) is set

Sourceval ignorecase : t -> bool

returns a bool indicating whether the ignorecase (i) flag is set

Sourceval multiline : t -> bool

returns a bool indicating whether the multiline (m) flag is set

Sourceval dotall : t -> bool

returns a bool indicating whether the dot all (s) flag is set

Sourceval sticky : t -> bool

returns a bool indicating whether the sticky (y) flag is set

Sourceval unicode : t -> bool

returns a bool indicating whether the unicode (u ) flag is set

Sourceval source : t -> string

returns the regexp pattern as a string

Sourceval test : t -> string -> bool

checks whether the given RegExp.t will match (or not match) a given string

Sourceval exec : t -> string -> result

executes a search on a given string using the given RegExp.t

Sourceval captures : result -> string array

an array of the match and captures

Sourceval groups : result -> (string * string) list

returns all named capture groups as a list of (name, value) pairs

Sourceval group : string -> result -> string option

returns the value of a named capture group, or None if not found

Sourceval input : result -> string

the original input string

Sourceval index : result -> int

sets the index at which the next match (RegExp.exec or RegExp.test) will start its search from