Link Search Menu Expand Document

RegexMatcher.Group Method

Explanation Gets the substring of the matched result.

If you specify group, you can get the substring forward-referenced by the 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, an empty string is returned.
Call format var s = rm.Group( [ group ] )
Return value Matched part or substring of forward reference group
From Ver.5.0.1, UString type string is returned in Unicode mode.
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 Start, End methods