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
Class | Name | Description |
string | groupName | A group name. |
Return value
Class | Description |
string | A 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.