using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"href=""(.+)"">(C#: парсинг HTML кода страницы)<";
string input = @"
<a class=""question-hyperlink"" href=""/questions/412931/c-%d0%bf%d0%b0%d1%80%d1%81%d0%b8%d0%bd%d0%b3-html-%d0%ba%d0%be%d0%b4%d0%b0-%d1%81%d1%82%d1%80%d0%b0%d0%bd%d0%b8%d1%86%d1%8b"">другая ссылка</a>
<a class=""question-hyperlink"" href=""http://ru.stackoverflow.com/questions/412931/c-%D0%BF%D0%B0%D1%80%D1%81%D0%B8%D0%BD%D0%B3-html-%D0%BA%D0%BE%D0%B4%D0%B0-%D1%81%D1%82%D1%80%D0%B0%D0%BD%D0%B8%D1%86%D1%8B"">C#: парсинг HTML кода страницы</a>
<a class=""question-hyperlink"" href=""/questions/412931/c-%d0%bf%d0%b0%d1%80%d1%81%d0%b8%d0%bd%d0%b3-html-%d0%ba%d0%be%d0%b4%d0%b0-%d1%81%d1%82%d1%80%d0%b0%d0%bd%d0%b8%d1%86%d1%8b"">C#: парсинг HTML кода страницы</a>
<a class=""question-hyperlink"" href=""/questions/412931/c-%d0%bf%d0%b0%d1%80%d1%81%d0%b8%d0%bd%d0%b3-html-%d0%ba%d0%be%d0%b4%d0%b0-%d1%81%d1%82%d1%80%d0%b0%d0%bd%d0%b8%d1%86%d1%8b"">другая ссылка</a>
<a class=""question-hyperlink"" href=""/questions/412931/c-%d0%bf%d0%b0%d1%80%d1%81%d0%b8%d0%bd%d0%b3-html-%d0%ba%d0%be%d0%b4%d0%b0-%d1%81%d1%82%d1%80%d0%b0%d0%bd%d0%b8%d1%86%d1%8b"">другая ссылка</a>";
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