Expand description
Regular expression operations for Seq
These functions are exported with C ABI for LLVM codegen to call. Uses Rust’s regex crate - fast, safe, no catastrophic backtracking.
§API
# Match check
"hello world" "wo.ld" regex.match? # ( String String -- Bool )
# Find first match
"a1 b2 c3" "[a-z][0-9]" regex.find # ( String String -- String Bool )
# Find all matches
"a1 b2 c3" "[a-z][0-9]" regex.find-all # ( String String -- List )
# Replace first occurrence
"hello world" "world" "Seq" regex.replace
# ( String pattern replacement -- String )
# Replace all occurrences
"a1 b2 c3" "[0-9]" "X" regex.replace-all
# ( String pattern replacement -- String )
# Capture groups
"2024-01-15" "(\d+)-(\d+)-(\d+)" regex.captures
# ( String pattern -- List Bool ) returns ["2024", "01", "15"] true on match
# Split by pattern
"a1b2c3" "[0-9]" regex.split # ( String pattern -- List )Functions§
- patch_
seq_ ⚠regex_ captures - Extract capture groups from a pattern match
- patch_
seq_ ⚠regex_ find - Find the first match of a pattern in the string
- patch_
seq_ ⚠regex_ find_ all - Find all matches of a pattern in the string
- patch_
seq_ ⚠regex_ match - Check if a pattern matches anywhere in the string
- patch_
seq_ ⚠regex_ replace - Replace the first occurrence of a pattern
- patch_
seq_ ⚠regex_ replace_ all - Replace all occurrences of a pattern
- patch_
seq_ ⚠regex_ split - Split a string by a pattern
- patch_
seq_ ⚠regex_ valid - Check if a pattern is a valid regex