using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"(\bhref=""(.*?)\b"")(?!.*\1)?";
string input = @" <div>
<a href=""showthread.php?t=5239160"" id=""thread_title_5239160"">программа для точного определения местоположения любого гаджета</a>
<span class=""smallfont"" style=""white-space:nowrap"">(<img class=""inlineimg"" src=""https://static.kharkovforum.com/images/misc/multipage.gif"" alt=""перейти на страницу"" border=""0"" /> <a href=""showthread.php?t=5239160"">1</a> <a href=""showthread.php?t=5239160&page=2"">2</a>)</span>
</div>
<div class=""smallfont"">
<span style=""cursor:pointer"" onclick=""window.open('member.php?u=502041', '_self')"">I-am</span>
</div>
";
foreach (Match m in Regex.Matches(input, pattern))
{
Console.WriteLine("'{0}' found at index {1}.", m.Value, m.Index);
}
}
}
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for C#, please visit: https://msdn.microsoft.com/en-us/library/system.text.regularexpressions.regex(v=vs.110).aspx