r = new Regex("(?<2>(?:\\<(a|A))\\s*href=*(?:\"(?<1>[^\"]*)\"|(?<1>\\S+))[^\\<\\>]*\\>[^(\\<\\/a>)]*(?:\\<\\/(a|A)\\>))",RegexOptions.IgnoreCase|RegexOptions.Compiled);
for (m = r.Match(inputString); m.Success; m = m.NextMatch())
{
Console.WriteLine("Found href " + m.Groups[1] + " at " + m.Groups[1].Index+"\n");
tempCount++;
}