62,046
社区成员
发帖
与我相关
我的任务
分享
WebRequest Wrq = WebRequest.Create(要爬的地址);
WebResponse Wrs = Wrq.GetResponse();
Stream strm = Wrs.GetResponseStream();
StreamReader sr = new StreamReader(strm, System.Text.Encoding.GetEncoding("UTF-8"));
string allstrm;
allstrm = sr.ReadToEnd();
string strPattern = @"要抓东西的正则";
MatchCollection Matches = Regex.Matches(allstrm, strPattern, RegexOptions.IgnoreCase | RegexOptions.Compiled);
foreach (Match NextMatch in Matches)
{
得到结果 = NextMatch.Groups[0].Value.ToString().Trim();
}