This article describes the method of extracting hyperlink links and text parts in web pages in C#. Share it for your reference, as follows:
string s = ".."; Regex re = new Regex(@"<a[^>]*href=(""(?<href>[^""]*)""|'(?<href>[^']*)'|(?<href>[^\s>]*))[^>]*>(?<text>.*?)</a>", | ); Match m = (s); if() { string link = ["href"].Value; string text = (["text"].Value,"<[^>]*>",""); ("link:{0}\ntext:{1}", link, text); }
For more information about C# related content, please check out the topic of this site:Summary of the usage of C# regular expressions"and"Summary of C# string operation skills》
I hope this article will be helpful to everyone's C# programming.