正则提取--新手问题
get网址,返回数据
<a href="http://as.xxx.com/" onclick="co('as')">鞍山</a><a href="http://ay.xxx.com/" onclick="co('ay')">安阳......</a>
string s=@"<a href=""http://as.xxx.com/"" onclick=""co('as')"">鞍山</a><a href=""http://ay.xxx.com/"" onclick=""co('ay')"">安阳......</a>"; MatchCollection matches = Regex.Matches(s, @"(?is)(?<=onclick=""co\(')[^']+(?='\))"); foreach (Match match in matches) Response.Write(match.Value + "<br/>");
[解决办法]
(?<=co\(')[^']+(?='\))