I'm trying get the offset of a regex capture in .NET just like .IndexOf()
would return. Is there anyway to do that?
views:
148answers:
1
+2
A:
The result of the Regex.Match
will be a Match
object. Check the Index property of that
Match m = Regex.Match(input, pattern);
int i = m.Index;
hth
PaulB
2009-03-28 18:28:29