请教两个问题
1:
在这个网页中http://www.elong.com/hotels/details.aspx?m=commentary&hotelid=40101002
我想用正则表达式匹配出用户名,服务分,价格分,设施分
还有评论内容,正则表达式该怎么写??2:在这个网页中:http://www.elong.com/hotels/
随便查找一个酒店,比如北京昆仑饭店,进入后,通过源代码会发现 北京昆仑饭店的ID是40101002 
我怎么把这个ID匹配出来??
高手帮忙解答下,谢谢各位

解决方案 »

  1.   

    北京昆仑饭店的ID是40101002 
    可以根据hotelid=40101002 得到
      

  2.   

    1、<div\sclass="div_z1">[\s\S]+?<A[^>]+>(?<user>.+?)</A></div>[\s\S]+?<div\sclass="comment_pftext">(?<service>.+?)</div>[\s\S]+?<div\sclass="comment_text"><b>(?<content>[\s\S]+?)<span[\s\S]+?>试试
      

  3.   

    第一个问题MatchCollection mc = Regex.Matches(str, @"用户:(\s*<[^>]*>)*(?<user>[^<>]*)[\s\S]*?服务:\s*(?<service>\d+)[\s\S]*?价格:\s*(?<price>\d+)[\s\S]*?设施:\s*(?<est>\d+)", RegexOptions.IgnoreCase);
    foreach (Match m in mc)
    {
        richTextBox1.Text += m.Groups["user"].Value + "\n";
        richTextBox1.Text += m.Groups["service"].Value + "\n";
        richTextBox1.Text += m.Groups["price"].Value + "\n";
        richTextBox1.Text += m.Groups["est"].Value + "\n";
    }第二个问题页面提示系统升级中
    要先找到能唯一定位这个id的字符串,根据这个字符串定位id,提取就行了