regex
native moduleA small backtracking engine (no PCRE). import "regex". Supports . * + ? ^ $, [...]/[^...] classes with ranges, \d \w \s (and \D \W \S), | alternation, and () grouping. No capture extraction, {n,m} counts, or backreferences; matches on bytes. All functions take (pattern, text) first.
regex.match(pattern, text: string) => boolregex.find(pattern, text: string) => string?regex.find_all(pattern, text: string) => [string]regex.replace(pattern, text, replacement: string) => stringregex.split(pattern, text: string) => [string]
regex.match(pattern, text: string) => bool
Does the pattern match the entire text (honoring ^/$).
regex.find(pattern, text: string) => string?
First matching substring, or nil.
regex.find_all(pattern, text: string) => [string]
All non-overlapping matches.
regex.replace(pattern, text, replacement: string) => string
Replace every match with the literal replacement (no $1).
regex.split(pattern, text: string) => [string]
Split text on each match.