您好,您这样:提取链接的标签文本和url地址
将Html文件代码传入string参数s,代码如下:
private void Reg_A_Href(string s)
{
string str = s;
Regex re = new Regex(@"]+href=\s*(?:'(?
MatchCollection mc = re.Matches(str);
Console.WriteLine(mc.Count);
foreach (Match m in mc)
{
info_Add("[href] " + m.Groups["href"].Value);
info_Add("[text] " + m.Groups["text"].Value);
Console.WriteLine("{0}:{1}", m.Groups["href"].Value, m.Groups["text"].Value);
}
}