string html = “html代码”; Regex reg = new Regex(@"(?is) ]*?href=(['""]?)(?[^'""\s>]+)\1[^>]*>(? (?:(?! "); MatchCollection mc = reg.Matches(html);foreach (Match m in mc) { string url = m.Groups["url"].Value; string text = m.Groups["text"].Value; }
本文共 348 字,大约阅读时间需要 1 分钟。
string html = “html代码”; Regex reg = new Regex(@"(?is) ]*?href=(['""]?)(?[^'""\s>]+)\1[^>]*>(? (?:(?! "); MatchCollection mc = reg.Matches(html);foreach (Match m in mc) { string url = m.Groups["url"].Value; string text = m.Groups["text"].Value; }
转载地址:http://azogo.baihongyu.com/