Skip to main content
rb.regex matches, finds, replaces and splits text by pattern. A script reaches for it to pull a number or a name out of a line of text, or to rewrite text where a plain string search is not enough. This script reads the gold amount from a line, lists every name and number in it, and rewrites it:
Patterns use Rust regex syntax: no lookaround or backreferences. Write patterns as long strings, such as [[\d+]], to avoid Luau escapes. An invalid pattern raises invalid regex '<pattern>': <reason>. A match is { match, captures, start, finish }: captures lists the groups and start, finish are 1-based byte offsets. Replacements refer to groups as $1, $2.