match クラス : Group(string) メソッド
説明
グループ名によって選択される正規表現グループに一致する部分文字列を取得します。
構文
matchInstance.Group(string groupName)
引数
| クラス | 名前 | 説明 |
| string | groupName | グループ名。 |
返り値
| クラス | 説明 |
| string | グループ名によって選択される正規表現グループに一致する部分文字列。 |
サンプルコード
| 1: | regex pattern = new match("(?<first>\d)(?<second>\d)"); |
| 2: | match firstMatch= pattern.MatchM("ww1245cc66"); // "12"に一致。 |
| 3: | string resultStr = firstMatch.Group("first"); // "1" |
| 4: | resultStr = firstMatch.Group("second"); // "2" |
注意
これは、System.Text.RegularExpressions.Match.Groups プロパティのラッパーです。


