Regular expressions. import regex.
Check if a pattern matches anywhere in a string.
regex.is_match("[0-9]+", "abc123") // => true
Check if a pattern matches the entire string.
regex.full_match("[0-9]+", "123") // => true
Find the first match of a pattern in a string.
regex.find("[0-9]+", "abc123def") // => some("123")
Find all non-overlapping matches of a pattern.
regex.find_all("[0-9]+", "a1b2c3") // => ["1", "2", "3"]
Replace all matches of a pattern with a replacement string.
regex.replace("[0-9]+", "a1b2", "X") // => "aXbX"
Replace the first match of a pattern.
regex.replace_first("[0-9]+", "a1b2", "X") // => "aXb2"
Split a string by a regex pattern.
regex.split("[,;]", "a,b;c") // => ["a", "b", "c"]
Extract capture groups from the first match.
regex.captures("(\\w+)@(\\w+)", "user@host") // => some(["user@host", "user", "host"])