radlang — Regular expressions

The regex namespace compiles POSIX extended regular expressions into a RegEx value.

RegEx re = regex.from("hello[world]", "i")
bool matched = re.isMatch("HELLOw")
string? first = re.find("say HELLOw")
string replaced = re.replace("hello world", "hello", "hi")
re.close()

API

fn regex.from(string pattern, string flags?): RegEx
fn RegEx.isMatch(string text): bool
fn RegEx.find(string text): string?
fn RegEx.replace(string text, string replacement): string
fn RegEx.close(): void

find returns null when there is no match. A compiled expression can also be used as a disposable resource with using.