码迷,mamicode.com
首页 > Web开发 > 详细

利用WebClient和正则提取网页QQ邮箱

时间:2015-08-31 15:04:49      阅读:171      评论:0      收藏:0      [点我收藏+]

标签:

string strUrl = txtUrl.Text.Trim() + "?pn=";
int iPageSize = Convert.ToInt32(txtPageSize.Text.Trim());
WebClient wc = new WebClient();
StringBuilder sb = new StringBuilder();
string html = "";
wc.Encoding = Encoding.Default;

for (int i = 1; i <= iPageSize; i++)
{
strUrl += i;
html = wc.DownloadString(strUrl);
MatchCollection mc = Regex.Matches(html, @"[1-9]\d{4,11}@(qq|QQ).com");
foreach (Match m in mc)
{
sb.AppendLine(m.Value + ";");
}
}

File.AppendAllText(@"h:\1.txt", sb.ToString(), Encoding.Default);

利用WebClient和正则提取网页QQ邮箱

标签:

原文地址:http://www.cnblogs.com/kallynan/p/4772867.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!