match クラス : Groups() メソッド
説明
正規表現グループに一致する全ての部分文字列のリストを取得します。
構文
matchInstance.Groups()
引数
無し。
返り値
| クラス | 説明 |
| list{string} | 正規表現グループに一致する全ての部分文字列のリスト |
サンプルコード
| 1: | regex pattern = new regex("(\d)(\d)"); |
| 2: | match firstMatch= pattern.MatchM("ww1245cc66"); // "12"に一致。 |
| 3: | int count = firstMatch.GroupCount; // グループ数は、3。"12", "1", "2" |
| 4: | list{string} resultList = firstMatch.Groups(); |
| 5: | string resultStr = resultList.GetAt(0); // "12" |
| 6: | resultStr = resultList.GetAt(1); // "1" |
| 7: | resultStr = resultList.GetAt(2); // "2" |
注意
無し。


