API Reference › Regex › Regex.start
method

Regex.start

Regex.start(match, n) -> int

Returns the byte offset where group n of match begins, or -1 if the group did not participate. Group 0 is the whole match, so Regex.start(m, 0) is where the match begins.

Parameters

matcha Match value
nthe group number

Example

program Demo {
  entry {
    let m = Regex.find("  hi", "hi")
    print(Regex.start(m, 0))
  }
}
← All symbols