Group index's text, and whether it took part in the match. Group 0 is the whole match.
Regex :: #import "Extensions/Regex";
re, _ := Regex.compile("(a)(x)?");
caps, _ := Regex.captures(*re, "ab");
first, took_part := Regex.group(caps, 1);
assert(took_part && first == "a");
_, took_part = Regex.group(caps, 2);
assert(!took_part);
Regex.free_regex(*re);group :: (caps: Captures, index: int) -> (string, bool)
Parameters
- caps: Captures
- index: int
Returns
- string
- bool
group :: (caps: Captures, name: string) -> (string, bool)
The text of the group called name, and whether it took part in the match.
Parameters
- caps: Captures
- name: string
Returns
- string
- bool