62,268
社区成员
发帖
与我相关
我的任务
分享
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)
{
str = NextMatch.Groups["src"].Value.ToString().Trim();
}