http://feedback.ebay.com/ws/eBayISAPI.dll?ViewFeedback2&ftab=AllFeedback&userid=paragad&iid=-1&de=off&items=25&interval=0&mPg=151就是这个网址,我要获取到Feedback这个模块下面的所有指定数据As described, fast delivery, no problems.或者是Excellent product excellent service great persons to deal with thank you或者是excellent!!!!等这些评论内容帮我研究一下吧(求正则表达式)
行业数据C#正则表达式
行业数据C#正则表达式
具体用法:
http://blog.csdn.net/weiyangcau/article/details/7551081
string HtmlStr = sbXml.ToString().Replace("&nbsp;", ""); for (int i = 0; i <= 153; i++)
{
Html html = new Html();
string htmlCode = html.GetHTML("http://feedback.ebay.com/ws/eBayISAPI.dll?ViewFeedback2&ftab=AllFeedback&userid=paragad&iid=-1&de=off&items=25&interval=0&mPg=151&page=" + i, "gb2312");
//得到指定页面的html代码,第一个参数为url(貌似都知道),第二个是目标网页的编码集
//正则表达式
Regex regexarticles = new Regex("<span class=\"mbg-nw\">(.*?)+</span>");//获取买家名称
Regex re = new Regex(@"(?<=\(#)\d+(?=\))");//获取编号
Regex Comment = new Regex(@"(?is)(?<=</td><td>)[^<>]+(?=</td><td\s*nowrap=""nowrap"")");//获取评论内容
Regex us = new Regex("(?is)(?<=<table[^>]*?class=\"FbOuterYukon\">.*?<img[^>]*?alt=\").*?(?=\")");//获取图片alt评价信息
//所有匹配表达式的内容
System.Text.RegularExpressions.MatchCollection marticles = regexarticles.Matches(htmlCode);
System.Text.RegularExpressions.MatchCollection ma = re.Matches(htmlCode);
System.Text.RegularExpressions.MatchCollection co = Comment.Matches(htmlCode);
System.Text.RegularExpressions.MatchCollection uu = us.Matches(htmlCode);
//遍历匹配内容
int count = 0;
mode n = new mode();
foreach (Match m in marticles)
{
count++;
if (m.Groups[0].Value.IndexOf("paragad") < 0)
{
n.Buyers1 = Clear.GetKeyName(m.Groups[0].Value.Replace("paragad", ""));
}
foreach (Match k in ma)
{
n.Number1 = Clear.GetKeyName(k.Groups[0].Value);
}
foreach (Match c in co)
{
n.ContentFeedback1 = Clear.GetKeyName(c.Groups[0].Value);
}
foreach (Match u in uu)
{
if (u.Groups[0].Value.IndexOf("feedback rating") >= 0)
{
//rt_box.AppendText(Clear.GetKeyName(u.Groups[0].Value).Replace("feedback rating", "") + "\r\n");
n.ImageUrl1 = Clear.GetKeyName(u.Groups[0].Value).Replace("feedback rating", "");
}
}
}
lb_l.Visible = true;
lb_l.Text = "数据已经成功保存,请你查阅数据库!";
}
}
}
private void InsertData(mode m)
{
string sqlstr = "insert into FeedbackProfile (Buyers,Number,ContentFeedback,ImageUrl)values(@Buyers,@Number,@ContentFeedback,@ImageUrl)";
int i = SqlHelper.ExecuteNonQuery(sqlstr, CommandType.Text, new SqlParameter[]{
new SqlParameter("@Buyers",m.Buyers1),
new SqlParameter("@Number",m.Number1),
new SqlParameter("@ContentFeedback",m.ContentFeedback1),
new SqlParameter("@ImageUrl",m.ImageUrl1)
});
if (i > 0)
{
lb_l.Visible = true;
lb_l.Text = "数据已经保存成功,请你查阅数据库!";
}
else
{
lb_l.Visible = true;
lb_l.Text = "数据保存失败,可能你数据已经保存了不能重复保存!";
}
}大家帮忙看一下这个方法InsertData要放在那里才能把所获取的全部数据保存到数据库中阿???我现在已经把所需要的全部数据获取到了,就差保存数据库中了,求高手帮忙呀...