Regex module

Options

structextensionSource

Pattern flags, also settable inside the pattern: (?i) (?m) (?s) (?U) (?x) (?R) (?-u).

Example↗
Regex :: #import "Extensions/Regex";

options: Regex.Options;
options.case_insensitive = true;
re, ok := Regex.compile("hello", options);
assert(ok && Regex.is_match(*re, "Say HELLO"));
Regex.free_regex(*re);

Fields

case_insensitive: bool
i: letters match either case (Unicode simple case folding)
multi_line: bool
m: ^ and $ match at line breaks, not just the ends of the text
dot_all: bool
s: . also matches \n
swap_greed: bool
U: x* is lazy and x*? greedy
ignore_space: bool
x: whitespace is ignored and # starts a comment
crlf: bool
R: with m, \r\n also ends a line, and . does not match \r
unicode: := true
u: classes and \b are Unicode-aware; off, they are ASCII and match bytes

See also