Link Search Menu Expand Document

RegexMatcher.Start Method

Explanation Gets the leading index of the matched result.

You can specify group to get the start index of the substring forward-referenced by a group of regular expression patterns.
Groups are numbered from 1 to right, with group 0 representing the entire pattern.

Regular expression patterns such as "(a) *" may match the empty string. In this case it returns -1 .
However, if you specify 0 for the group number, 0 is returned.
Call format var s = rm.Start( [ group ] )
Return value Matched part or start index of forward reference group
From Ver.5.0.1, the index is in character units in Unicode mode. Other than that, it is in bytes.
Arguments integer group The number of the forward reference group you want to get
If omitted, it will be 0 (entire pattern)
Exception Func 4 The argument value is invalid
Func 14 The value cannot be referenced
Example of use
var m = RegexPattern.Compile("Biz/([a-zA-Z]+)").Matcher("Biz/Browser");
if (m.Matches()) {
    print(m.Start(1), m.End(1), m.Group(1), "\n");
}
    
Related item End, Group methods