Regex module

captures_all

procedureextension2 overloadsSource

captures for every match, as find_all finds them.

Example↗
Regex :: #import "Extensions/Regex";

re, _ := Regex.compile("([a-z])=([0-9])");
all := Regex.captures_all(*re, "a=1, b=2");
assert(all.count == 2);
value, _ := Regex.group(all[1], 2);
assert(value == "2");
Regex.free_regex(*re);
captures_all :: (re: *Regex, text: string) -> [..] Captures

Parameters

re: *Regex
text: string

Returns

captures_all :: ($R: Type, text: string) -> [..] R.Groups

captures for every match.

Parameters

$R: Type
text: string

Returns

[..] R.Groups
Example↗
Regex :: #import "Extensions/Regex";
Pair :: Regex.Static("(?<key>[a-z]+)=(?<value>[0-9]+)");

pairs := Regex.captures_all(Pair, "a=1 b=2");
assert(pairs.count == 2 && pairs[1].key == "b");

See also