/regex
Compiled regular expressions (Regex) with matching, capture extraction, replacement, and splitting.
Functions & symbols#
Regex#
Compiles a regular expression `pattern` into a reusable `Regex` value.
| Parameter | Type | Optional | Description |
|---|---|---|---|
pattern | String | required | Regular expression pattern string |
Any(let re (regex/Regex "^v(\\d+)\\.(\\d+)"))capture#
Returns the first full match substring in `text`, or `()` if none.
| Parameter | Type | Optional | Description |
|---|---|---|---|
re | Regex | String | required | Compiled Regex or pattern |
text | String | required | Input text |
Any(regex/capture "[0-9]+" "port=8080") ; -> "8080"captures#
Extracts positional and/or named capture groups from the first match of `re` in `text`.
| Parameter | Type | Optional | Description |
|---|---|---|---|
re | Regex | String | required | Compiled Regex or pattern |
text | String | required | Input text |
Any(regex/captures "(?<k>\\w+)=(?<v>\\d+)" "port=8080")captures-all#
Returns all successive non-overlapping capture matches in `text` as an Array.
| Parameter | Type | Optional | Description |
|---|---|---|---|
re | Regex | String | required | Compiled Regex or pattern |
text | String | required | Input text |
Any(regex/captures-all "\\w+" "a b c")is-matching?#
Returns `true` if `re` matches anywhere inside `text`.
| Parameter | Type | Optional | Description |
|---|---|---|---|
re | Regex | String | required | Compiled Regex or pattern string |
text | String | required | Input text to test |
Any(regex/is-matching? "\\d+" "id-42") ; -> truematching?#
Alias of `is-matching?`.
| Parameter | Type | Optional | Description |
|---|---|---|---|
re | Regex | String | required | Compiled Regex or pattern |
text | String | required | Input text |
Any(regex/matching? "^[a-z]+$" "tangu")replace#
Replaces all matches of `re` in `text` with `replacement`.
| Parameter | Type | Optional | Description |
|---|---|---|---|
text | String | required | Input text |
re | Regex | String | required | Regex or pattern to replace |
replacement | String | required | Replacement string (supports $1, $name backreferences) |
Any(regex/replace "2026-05-01" "-" "/") ; -> "2026/05/01"split#
Splits `text` around occurrences matching `sep-re`.
| Parameter | Type | Optional | Description |
|---|---|---|---|
sep_re | Regex | String | required | Separator Regex or pattern |
text | String | required | Input text to split |
Any(regex/split "[,\\s]+" "a, b c")split-matches#
Splits `text` while alternating matched substrings and unmatched slices.
| Parameter | Type | Optional | Description |
|---|---|---|---|
match_re | Regex | String | required | Regex matching tokens to preserve alongside delimiters |
text | String | required | Input text |
Any(regex/split-matches "\\d+" "a1b2c")