MatchCollection matches = Regex.Matches(textBox2.Text, @"<\s*a\s+[^>]*href\s*=\s*[""'](?<HREF>[^""']*)[""'][^>]*>(?<IHTML>[\s\S]+?)<\s*/\s*a\s*>", RegexOptions.IgnoreCase); foreach (Match match in matches) { string s = match.Groups["IHTML"].Value + ":" + match.Groups["HREF"].Value; links.Add(s); listBox1.Items.Add(s); }
摘自自己某半途而废的程序。
原创文章,作者:苏葳,如需转载,请注明出处:https://www.swmemo.com/570.html