Home Cooker Classes Others Rice CookerGX
Classes  >  regex  >  Group(string,int)
regex class : Group(string,int) method

Description

Gets a string of the group which is specified by the index.

Syntax

regexInstance.Group(string source ,int index)

Arguments

ClassNameDescription
stringsourceA string which is searched.
intindexA index.

Return value

ClassDescription
stringA string of the group which is specified by the index.

Sample code

//anyRegex is an any instance of regex type.

regex anyRegex = new regex("(a+)");

string result = anyRegex.Group("aaabbbaaccc", 0);//result is "aaa"。

Notes

It's a wrapper of the System.Text.RegularExpressions.Match.Groups.

The index is 0-based.

Links for reference

Copyright © Rice All rights reserved.