62,074
社区成员
发帖
与我相关
我的任务
分享
string strfromtxt = File.ReadAllText(@"C:\1.txt", Encoding.GetEncoding("GB2312"));
string res = @"(?<=http://item.taobao.com/item.htm\?id=)(?<id>(.*?))(?=(&|$))";
string pattern = @"(?is)<h2><a href=""/ticket_19872.html"">(?<title>(.*?))</a></h2>";
MatchCollection matches = Regex.Matches(strfromtxt, res);//strfromtxt 就是你的字符串,我放到文本中的
foreach (Match match in matches)
{
string contemp = match.Groups["id"].Value.Trim();//你要的值
listpath.Add(contemp);
}
Regex reg=new Regex("(?<=id=)\d+");
NameValueCollection qscoll = HttpUtility.ParseQueryString("http://item.taobao.com/item.htm?id=15692320037&ali_refid=a3_420999_1007:1102857363:7:bfa050d3f458644d909956929743f117:90fa5a98c7b8bfc8a311cfe2dd088e4c&ali_trackid=1_90fa5a98c7b8bfc8a311cfe2dd088e4c&spm=874.123733.232738.14");
// Iterate through the collection.
StringBuilder sb = new StringBuilder("<br />");
foreach (String s in qscoll.AllKeys)
{
sb.Append(s + " - " + qscoll[s] + "<br />");
}