Regular Expressions (regex)
The regex module provides regular expression pattern matching, extraction, search-and-replace, and splitting capabilities.
Functions
regex.is_match(pattern: String, text: String) -> Bool
Returns true if the regex pattern matches anywhere within the input text.
regex.find(pattern: String, text: String) -> String
Returns the first substring matching the pattern, or an empty string if no match is found.
regex.find_all(pattern: String, text: String) -> Vec[String]
Returns all non-overlapping matches as a vector of strings.
regex.replace(pattern: String, text: String, replacement: String) -> String
Replaces all occurrences of the pattern with the specified replacement string.
regex.split(pattern: String, text: String) -> Vec[String]
Splits a string by matching regular expression delimiters.