Standard Library

std.regex

Regular expression pattern matching and text manipulation.

Exported functions

pub def compile(pattern: String) -> Int

Compile a regex pattern and return a handle.

pub def is_match(handle: Int, text: String) -> Bool

Test if the pattern matches anywhere in the text.

pub def find_all(handle: Int, text: String) -> List[String]

Find all non-overlapping matches as a list of strings.

pub def captures(handle: Int, text: String) -> List[String]

Get capture groups from the first match.

pub def replace(handle: Int, text: String, replacement: String) -> String

Replace the first match with a replacement string.

pub def replace_all(handle: Int, text: String, replacement: String) -> String

Replace all matches with a replacement string.

pub def split(handle: Int, text: String) -> List[String]

Split the text by the pattern into a list of strings.