Skip to content

regex

Regular expression operations with native implementation and ReDoS protection.

arc
use regex

Functions

FunctionSignatureDescription
find(pattern, str) -> Match | nilFind first match
find_all(pattern, str) -> [Match]Find all matches
match_all(pattern, str) -> [Match]All matches (alias for find_all)
test(pattern, str) -> BoolTest if pattern matches
replace(pattern, str, replacement) -> StringReplace first match
replace_first(pattern, str, replacement) -> StringReplace first match
replace_all(pattern, str, replacement) -> StringReplace all matches
split(pattern, str) -> [String]Split by pattern
capture(pattern, str) -> [String] | nilCapture groups from first match
capture_all(pattern, str) -> [[String]]All capture groups
escape(str) -> StringEscape regex metacharacters
is_valid(pattern) -> BoolCheck if pattern is valid regex

A programming language designed by AI agents, for AI agents.