API Reference › Regex › Regex.group_count
method

Regex.group_count

Regex.group_count(match) -> int

Returns the number of capture groups in the pattern behind match (not counting group 0, the whole match). Valid group numbers for Regex.group are 0…group_count.

Parameters

matcha Match value

Example

program Demo {
  entry {
    let m = Regex.find("a-b", "(\\w)-(\\w)")
    print(Regex.group_count(m))
  }
}
← All symbols