Home Notices Documents Classes Download Others Rice
Classes  >  match  >  Group(string)
match class : Group(string) method

Description

Gets a substring that matches the regular expression group selected by the name.

Syntax

matchInstance.Group(string groupName)

Arguments

ClassNameDescription
stringgroupNameA group name.

Return value

ClassDescription
stringA substring that matches the regular expression group selected by the name.

Sample code

1:

regex pattern = new match("(?<first>\d)(?<second>\d)");

2:

match firstMatch= pattern.MatchM("ww1245cc66"); // It matches to "12".

3:

string resultStr = firstMatch.Group("first"); // "1"

4:

resultStr = firstMatch.Group("second"); // "2"

Notes

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

Links for reference

Copyright © Rice All rights reserved.