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

Regex.scan

~import std/regex.scan

Koru Standard Library: the `scan` part of regex.kz.

regex.scan.kz · 1 tors

Koru Standard Library: the `scan` part of regex.kz. · 17 more lines
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