<a id="Home_Link" href="Home.aspx?cid=32&rcid=2376&mlink=Home&sublink=Home_Employer">Home</a>
Regex re = new Regex(@"<a[^>]+id\s*=\s*""(?<id>[^""]+)\s*[^>]*>(?<text>.*?)</a>", RegexOptions.IgnoreCase | RegexOptions.Singleline);
MatchCollection mc = re.Matches(cd.Html); foreach (Match m in mc)
{
Response.Write(m.Groups["id"].Value + m.Groups["text"].Value + "<br/>");
}
我现在可以拿到id和text 想同时拿到href,怎么写?
Regex re = new Regex(@"<a[^>]+id\s*=\s*""(?<id>[^""]+)\s*[^>]*>(?<text>.*?)</a>", RegexOptions.IgnoreCase | RegexOptions.Singleline);
MatchCollection mc = re.Matches(cd.Html); foreach (Match m in mc)
{
Response.Write(m.Groups["id"].Value + m.Groups["text"].Value + "<br/>");
}
我现在可以拿到id和text 想同时拿到href,怎么写?
@"<a[^>]+id\s*=\s*""(?<id>[^""]+)""\s*href\s*=\s*""(?<href>[^""]+)""\s*[^>]*>(?<text>.*?)</a>"