tags:

views:

148

answers:

1

I'm trying get the offset of a regex capture in .NET just like .IndexOf() would return. Is there anyway to do that?

+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