match class : Index getter
Description
Gets a position of the substring in the original string.
Syntax
matchInstance.Index
Arguments
None
Return value
Class | Description |
int | A position of the substring in the original string. |
Sample code
1: | regex pattern = new regex("(b+)"); |
2: | match firstMatch= pattern.MatchM("aaabbbaaccc"); // "bbb" |
3: | int index = firstMatch.Index; // 3 |
Notes
It's a wrapper of the System.Text.RegularExpressions.Match.Index property.
The position is indicated by a zero-based index.