Compiles pattern. The result says whether it was valid and, if not, the error says where it
went wrong. Free the regex with free_regex.
Regex :: #import "Extensions/Regex";
re, ok, error := Regex.compile("[a-z]+[0-9]");
assert(ok);
Regex.free_regex(*re);
_, ok, error = Regex.compile("(unclosed");
assert(!ok && error.message.count > 0);- pattern: the regular expression.
- options: flags such as case-insensitive matching.
compile :: (
pattern: string,
options := Options.{}
) -> (Regex, ok: bool, Error)
Compiles pattern. The result says whether it was valid and, if not, the error says where it
went wrong. Free the regex with free_regex.
Parameters
- pattern: string
- the regular expression.
- options := Options.{}
- flags such as case-insensitive matching.
Returns
- ok: bool
Regex :: #import "Extensions/Regex";
re, ok, error := Regex.compile("[a-z]+[0-9]");
assert(ok);
Regex.free_regex(*re);
_, ok, error = Regex.compile("(unclosed");
assert(!ok && error.message.count > 0);