This library is in flux. APIs may change without notice. Generated from source with koruc 0.1.7 on 11/17/2026.

Regex

import std/regex

regex.kz · 3 tors · ~[comptime]

match

comptimetransform koru_std/regex.kz:60

~part norm koru_std/regex.norm.kz

Koru Standard Library: the `norm` part of regex.kz. Joined via `~part norm` in regex.kz; merged into the regex module at load. Reads the `:` spec on delivery-arm destructures and normalizes it out of the emission path — `{ l: i64 }` carries the conversion spec in the `:` slot: ident-shaped RHS lands on `path` (the parser can't tell `i64` from a field name), sigil-shaped RHS on `type_text`. Either way it is THIS tor's spec — and the emitted binding must read the payload by capture name (`dst.l`), never `dst.i64`.

~part scan koru_std/regex.scan.kz

Koru Standard Library: the `scan` part of regex.kz. Joined via `~part scan` in regex.kz; merged into the regex module at load. SCAN - unanchored, streaming regex: `!` (each) where match uses `|` (once). `match` finds ONE whole-input match (anchored); `scan` finds EVERY non-overlapping occurrence as an effect stream — it fires its `!` pattern branch per hit (with the same named-group destructure match uses), then runs the optional `| done` continuation once. This is the terminal layer of the parser stack: a lexer in a few lines. Built on the engine's leftmost-longest unanchored search: the compiled SEARCH fn locates each span, and the same captures matcher `match` uses extracts the groups from that span. The `!` branch body is spliced once via `__koru_inline_<idx>` — INSIDE the loop it therefore runs per match, which is exactly effect-branch semantics. Single pattern for now (multi-pattern scan is pinned as a follow-up); pattern branches MUST be effect `!` (dispatch-into-each-match), mirroring the router.

scan

comptimetransform koru_std/regex.scan.kz:20

~part replace koru_std/regex.replace.kz

Koru Standard Library: the `replace` part of regex.kz. Joined via `~part replace` in regex.kz; merged into the regex module at load. REPLACE - sed-style substitution over the compiled search fn. `std/regex:replace { input, with: "tmpl" } | `pattern` out` walks every non-overlapping occurrence (the same leftmost-longest search `scan` rides) and hands the arm's binding the rebuilt text: literal runs pass through untouched and each match is swapped for the template's expansion. Template vocabulary (Lars's ruled sed convention): `\1..\9` is the Nth capture group in open order — every capture here is a `(?<name>…)` group so position == named-group order — `\{name}` is a named group, `\\` is a literal backslash, and a backslash before any other character passes through verbatim. An unmatched optional group expands empty. `with:` must be a quoted literal; no match hands the input back unchanged.

replace

comptimetransform koru_std/regex.replace.kz:19