[Solved] Regular Expression to find out tag and get the value of HREF using C# [duplicate]


Don’t use Regex to parse html. A correct way would be using an html parser like HmlAgilityPack

var doc = new HtmlAgilityPack.HtmlDocument();
doc.LoadHtml(htmlstring);

var links = doc.DocumentNode.SelectNodes("//a")
               .Select(a => a.Attributes["href"].Value)
               .ToList();

solved Regular Expression to find out tag and get the value of HREF using C# [duplicate]