首页 新闻 会员 周边

c#正则表达式获取代码中的标题与日志ID号码。(QQ空间日志的采集操作)

0
悬赏园豆:60 [已解决问题] 解决于 2012-08-03 17:58

问题如题:附代码如下

View Code
_Callback({"blogids":[1338208697, 1343713117, 1343712578, 1343712001, 1343711473], "html":"<ul class=\"guest_mode\">               <li class=\"odd                    \">    <input type=\"checkbox\" name=\"batchSingleCheckInput\" bid=\"1338208697\" />     <!-- 左边标题 -->    <p class=\"list_tit\">     [<a class=\"unline\" href=\"javascript:;\" onclick=\"ListManager.selectCategory(\'个人日记\',\'b8f6c8cbc8d5bcc7\');QZBlog.Util.Statistic.sendPV(\'classname_click\', \'rizhi.qzone.qq.com\');return false;\" title=\"个人日记\">个人日记</a>]      <a href=\"javascript:;\" class=\"blog_link\" onclick=\"ListManager.selectBlog(1338208697);return false;\">      <span title=\"title -- 发表于2012-05-28 20:38\">                     <em class=\"c_tx4\">[顶]</em>              <span id=\"blogtitle_1338208697\" >        title       </span>      </span>                                                                          </a>                <span class=\"blog_num c_tx2\" title=\"title -- 发表于 2012-05-28 20:38\">2012-05-28 20:38</span>         </p>        <!-- 右边功能选项 -->    <div class=\"list_num \">     <!-- (评论/阅读) -->     (<span class=\"hit_none\"><span id=\"ReplyCntSpan1338208697\" style=\"text-decoration:none\" title=\"评论数:49\">49</span>/<span id=\"ViewCntSpan1338208697\" style=\"text-decoration:none\" title=\"阅读数\">loading</span></span>)          </div>   </li>             <li class=\"       bg3                    \">    <input type=\"checkbox\" name=\"batchSingleCheckInput\" bid=\"1343713117\" />     <!-- 左边标题 -->    <p class=\"list_tit\">     [<a class=\"unline\" href=\"javascript:;\" onclick=\"ListManager.selectCategory(\'个人日记\',\'b8f6c8cbc8d5bcc7\');QZBlog.Util.Statistic.sendPV(\'classname_click\', \'rizhi.qzone.qq.com\');return false;\" title=\"个人日记\">个人日记</a>]      <a href=\"javascript:;\" class=\"blog_link\" onclick=\"ListManager.selectBlog(1343713117);return false;\">      <span title=\"黑马QQ群营销大师软件营销效果分析 -- 发表于2012-07-31 13:38\">                            <em class=\"c_tx4\">[转]</em>       <span id=\"blogtitle_1343713117\" >        黑马QQ群营销大师软件营销效果分析       </span>      </span>            <img src=\"/ac/b.gif\" alt=\"附带图片\" title=\"附带图片\" class=\"icon_pic\"/>                                                              </a>                <span class=\"blog_num c_tx2\" title=\"黑马QQ群营销大师软件营销效果分析 -- 发表于 2012-07-31 13:38\">2012-07-31 13:38</span>         </p>        <!-- 右边功能选项 -->    <div class=\"list_num \">     <!-- (评论/阅读) -->     (<span class=\"hit_none\"><span id=\"ReplyCntSpan1343713117\" style=\"text-decoration:none\" title=\"评论数:0\">0</span>/<span id=\"ViewCntSpan1343713117\" style=\"text-decoration:none\" title=\"阅读数\">loading</span></span>)          </div>   </li>             <li class=\"odd                    \">    <input type=\"checkbox\" name=\"batchSingleCheckInput\" bid=\"1343712578\" />     <!-- 左边标题 -->    <p class=\"list_tit\">     [<a class=\"unline\" href=\"javascript:;\" onclick=\"ListManager.selectCategory(\'个人日记\',\'b8f6c8cbc8d5bcc7\');QZBlog.Util.Statistic.sendPV(\'classname_click\', \'rizhi.qzone.qq.com\');return false;\" title=\"个人日记\">个人日记</a>]      <a href=\"javascript:;\" class=\"blog_link\" onclick=\"ListManager.selectBlog(1343712578);return false;\">      <span title=\"名间特效胃药-胃宁 -- 发表于2012-07-31 13:29\">                            <em class=\"c_tx4\">[转]</em>       <span id=\"blogtitle_1343712578\" >        名间特效胃药-胃宁       </span>      </span>            <img src=\"/ac/b.gif\" alt=\"附带图片\" title=\"附带图片\" class=\"icon_pic\"/>                                      <img src=\"/ac/b.gif\" alt=\"附带信纸\" title=\"附带信纸\" class=\"icon_letter\"/>                        </a>                <span class=\"blog_num c_tx2\" title=\"名间特效胃药-胃宁 -- 发表于 2012-07-31 13:29\">2012-07-31 13:29</span>         </p>        <!-- 右边功能选项 -->    <div class=\"list_num \">     <!-- (评论/阅读) -->     (<span class=\"hit_none\"><span id=\"ReplyCntSpan1343712578\" style=\"text-decoration:none\" title=\"评论数:0\">0</span>/<span id=\"ViewCntSpan1343712578\" style=\"text-decoration:none\" title=\"阅读数\">loading</span></span>)          </div>   </li>             <li class=\"       bg3                    \">    <input type=\"checkbox\" name=\"batchSingleCheckInput\" bid=\"1343712001\" />     <!-- 左边标题 -->    <p class=\"list_tit\">     [<a class=\"unline\" href=\"javascript:;\" onclick=\"ListManager.selectCategory(\'个人日记\',\'b8f6c8cbc8d5bcc7\');QZBlog.Util.Statistic.sendPV(\'classname_click\', \'rizhi.qzone.qq.com\');return false;\" title=\"个人日记\">个人日记</a>]      <a href=\"javascript:;\" class=\"blog_link\" onclick=\"ListManager.selectBlog(1343712001);return false;\">      <span title=\"走在一起是缘份,一起在走是幸福 -- 发表于2012-07-31 13:20\">                            <em class=\"c_tx4\">[转]</em>       <span id=\"blogtitle_1343712001\" >        走在一起是缘份,一起在走是幸福       </span>      </span>                                                                          </a>                <span class=\"blog_num c_tx2\" title=\"走在一起是缘份,一起在走是幸福 -- 发表于 2012-07-31 13:20\">2012-07-31 13:20</span>         </p>        <!-- 右边功能选项 -->    <div class=\"list_num \">     <!-- (评论/阅读) -->     (<span class=\"hit_none\"><span id=\"ReplyCntSpan1343712001\" style=\"text-decoration:none\" title=\"评论数:0\">0</span>/<span id=\"ViewCntSpan1343712001\" style=\"text-decoration:none\" title=\"阅读数\">loading</span></span>)          </div>   </li>             <li class=\"odd                    \">    <input type=\"checkbox\" name=\"batchSingleCheckInput\" bid=\"1343711473\" />     <!-- 左边标题 -->    <p class=\"list_tit\">     [<a class=\"unline\" href=\"javascript:;\" onclick=\"ListManager.selectCategory(\'个人日记\',\'b8f6c8cbc8d5bcc7\');QZBlog.Util.Statistic.sendPV(\'classname_click\', \'rizhi.qzone.qq.com\');return false;\" title=\"个人日记\">个人日记</a>]      <a href=\"javascript:;\" class=\"blog_link\" onclick=\"ListManager.selectBlog(1343711473);return false;\">      <span title=\"千米QQ空间营销软件常用广告--图片超级链接代码分享(广告必备) -- 发表于2012-07-31 13:11\">                            <em class=\"c_tx4\">[转]</em>       <span id=\"blogtitle_1343711473\" >        千米QQ空间营销软件常用广告--图片超级链接代码分享(广告必备)       </span>      </span>                                                                          </a>                <span class=\"blog_num c_tx2\" title=\"千米QQ空间营销软件常用广告--图片超级链接代码分享(广告必备) -- 发表于 2012-07-31 13:11\">2012-07-31 13:11</span>         </p>        <!-- 右边功能选项 -->    <div class=\"list_num \">     <!-- (评论/阅读) -->     (<span class=\"hit_none\"><span id=\"ReplyCntSpan1343711473\" style=\"text-decoration:none\" title=\"评论数:0\">0</span>/<span id=\"ViewCntSpan1343711473\" style=\"text-decoration:none\" title=\"阅读数\">loading</span></span>)          </div>   </li>      </ul>   "})

利用正则表达式实现取出每一个日志标题与对应的ID号码。

如代码:<span id=\"blogtitle_1343712578\" >        名间特效胃药-胃宁       </span> 

其中的:1343712578 为所须取出的日志ID号码

“名间特效胃药-胃宁"   为日志标题。所获取代码中每一篇日志的格式都是如此,唯一不同的就是ID号与日志标题内容不一样。求解……

老虎下山的主页 老虎下山 | 初学一级 | 园豆:43
提问于:2012-08-03 12:21
< >
分享
最佳答案
1
string str = "<span id=\"blogtitle_1343712578\" >        名间特效胃药-胃宁       </span>";
            Regex reg = new Regex("<span id=\"blogtitle_(?<ID>.*?)\" >(?<Title>.*?)</span>");
            MatchCollection m;
            m = reg.Matches(str);
            string[] MatchValue = new string[m.Count];
            for (int i = 0; i < m.Count; i++)
            {
                MatchValue[i] = m[i].Groups["ID"].Value.Trim();
         MatchValue[i] = m[i].Groups["Title"].Value.Trim();
       }

楼主用这段代码就可以,取值的话就用在for循环里

az235 | 大侠五级 |园豆:8483 | 2012-08-03 14:45

我这测试无法取出啊,求解

老虎下山 | 园豆:43 (初学一级) | 2012-08-03 16:42

@老虎下山: 贴出你的代码来

az235 | 园豆:8483 (大侠五级) | 2012-08-03 16:46

@老虎下山: 我看下你是怎么写的

az235 | 园豆:8483 (大侠五级) | 2012-08-03 16:46

@az235: 直接 用messagebox show 出字符串的,但是调试过程中查看到,正则根本没有匹配到任何值 。m.count 的值 为0

老虎下山 | 园豆:43 (初学一级) | 2012-08-03 17:05

@老虎下山:你把程序放上来下,我看看,完整的代码

az235 | 园豆:8483 (大侠五级) | 2012-08-03 17:11

@az235: 

WebClient getID = new WebClient();
            string url = "http://b.qzone.qq.com/cgi-bin/blognew/blog_output_titlelist?uin=" + qq + "&vuin=0&property=GoRE&getall=1&styledm=ctc.qzonestyle.gtimg.cn&imgdm=ctc.qzs.qq.com&bdm=b.qzone.qq.com&category=&num=15&sorttype=0&arch=0&from=-15&maxlen=68&v=1";
string str = getID.DownloadString(url);
Regex reg = new Regex("<span id=\"blogtitle_(?<id>.*?)\" >(?<title>.*?)</span>");
            MatchCollection m;
            m = reg.Matches(str);
            string[] MatchValue = new string[m.Count];
            for (int i = 0; i < m.Count; i++)
            {
                MatchValue[i] = m[i].Groups["id"].Value.Trim(); 
                MatchValue[i] = m[i].Groups["title"].Value.Trim();
                MessageBox.Show(MatchValue[i].ToString());
            }
老虎下山 | 园豆:43 (初学一级) | 2012-08-03 17:13

@老虎下山: qq变量的值是多少?

az235 | 园豆:8483 (大侠五级) | 2012-08-03 17:18

@az235: QQ号码即可

老虎下山 | 园豆:43 (初学一级) | 2012-08-03 17:23

@老虎下山: 我测试用的号码:450329990 取值 就不成功。

老虎下山 | 园豆:43 (初学一级) | 2012-08-03 17:34

@老虎下山: 

 WebClient getID = new WebClient();
            string url = "http://b.qzone.qq.com/cgi-bin/blognew/blog_output_titlelist?uin=1343711473&vuin=0&property=GoRE&getall=1&styledm=ctc.qzonestyle.gtimg.cn&imgdm=ctc.qzs.qq.com&bdm=b.qzone.qq.com&category=&num=15&sorttype=0&arch=0&from=-15&maxlen=68&v=1";
            string str = getID.DownloadString(url);
            str = str.Replace("\\","");
            Regex reg = new Regex("<span id=\"blogtitle_(?<id>.*?)\" >(?<title>.*?)</span>");
            MatchCollection m;
            m = reg.Matches(str);
            string[] MatchValue = new string[m.Count];
            for (int i = 0; i < m.Count; i++)
            {
                MatchValue[i] = m[i].Groups["id"].Value.Trim();
            }
返回的内容要替换下,加上这句话 str = str.Replace("\\","");
原因是返回\" 在调试状态下看到的是\\\"这样的
az235 | 园豆:8483 (大侠五级) | 2012-08-03 17:45

@az235: 谢谢,成功得解啦。

老虎下山 | 园豆:43 (初学一级) | 2012-08-03 17:56

@az235: 

_Callback({"infos":{"bmore":0,"fmore":1,"info":[{"account":"hunantv2011","flag1":129,"flag2":0,"follower":1069530,"following":32,"idol":0,"nick":"2011\u6e56\u5357\u6625\u665a","portrait":"http://mbloghead.store.qq.com/mbloghead/97855424cac575e8bc14","tweet":{"city":"4","content":[{"con":"\u7389\u5154\u5448\u7965\u8e0f\u6625\u6765\uff0c\u4eca\u665a19:30\u5206\u6e56\u5357\u536b\u89c6\u64ad\u51fa2011\u6e56\u5357\u536b\u89c6\u6625\u8282\u8054\u6b22\u665a\u4f1a\uff0c\u5728\u665a\u4f1a\u64ad\u51fa\u8fc7\u7a0b\u4e2d\uff0c\u5404\u4f4d\u670b\u53cb\u6765\u5fae\u535a\u4e0a\u53d1\u9001\u4f60\u7684\u65b0\u5e74\u5fc3\u613f\u5427\uff0c\u6709\u673a\u4f1a\u83b7\u5f97\u8292\u679c2011\u53f0\u5386\u548c\u5929\u5a31\u7fa4\u661f\u7b7e\u540d\u7167\uff0c\u8d76\u7d27\u884c\u52a8\u8d77\u6765\uff01","type":3}],"country":"1","ctype":1,"from":3,"id":"42505105325568","imgs":null,"musics":null,"ocontent":"\u7389\u5154\u5448\u7965\u8e0f\u6625\u6765\uff0c\u4eca\u665a19:30\u5206\u6e56\u5357\u536b\u89c6\u64ad\u51fa2011\u6e56\u5357\u536b\u89c6\u6625\u8282\u8054\u6b22\u665a\u4f1a\uff0c\u5728\u665a\u4f1a\u64ad\u51fa\u8fc7\u7a0b\u4e2d\uff0c\u5404\u4f4d\u670b\u53cb\u6765\u5fae\u535a\u4e0a\u53d1\u9001\u4f60\u7684\u65b0\u5e74\u5fc3\u613f\u5427\uff0c\u6709\u673a\u4f1a\u83b7\u5f97\u8292\u679c2011\u53f0\u5386\u548c\u5929\u5a31\u7fa4\u661f\u7b7e\u540d\u7167\uff0c\u8d76\u7d27\u884c\u52a8\u8d77\u6765\uff01","province":"43","src":"\u817e\u8baf\u5fae\u535a","srcurl":"","status":0,"time":1296618549,"type":1,"videos":null,"votes":null},"uin":"c4d7f7fe77304499"},{"account":"IceingF11","flag1":1,"flag2":0,"follower":110157,"following":161,"idol":0,"nick":"Iceing_F11","portrait":"http://mbloghead.store.qq.com/mbloghead/c020469a74417bb38530","tweet":{"city":"8","content":[{"con":"\u300a\u5782\u76f4\u6781\u9650\u300b\uff0c\u591a\u5e74\u524d\u7684\u7ecf\u5178\u8001\u7247\u3002\u4ece\u5267\u60c5\u548c\u60c5\u611f\u5ba3\u6cc4\u4e0a\u770b\u662f\u6bd4\u8f83\u4fd7\u5957\u7684\uff0c\u6bd5\u7adf\u52b1\u5fd7\u8fd0\u52a8\u7684\u7c7b\u578b\u7247\u82b1\u6837\u5df2\u7ecf\u57fa\u672c\u73a9\u4e86\u4e2a\u904d\u3002\u4f46\u4e0d\u5f97\u4e0d\u8bf4\uff0c\u5f71\u7247\u5bf9\u4e8e\u8282\u594f\u7684\u628a\u63e1\uff0c\u5173\u952e\u8f6c\u6298\u70b9\u7684\u628a\u63e1\u662f\u529f\u529b\u975e\u51e1\u7684\u3002\u7528\u4e25\u9177\u7684\u73af\u5883\u3001\u6781\u9650\u7684\u6311\u6218\u3001\u6263\u4eba\u5fc3\u5f26\u7684\u6865\u6bb5\u6765\u63a9\u76d6\u672c\u8eab\u81ea\u5e26\u7684\u77eb\u60c5\uff0c\u5b8c\u5168\u53ef\u4ee5\u63a9\u9970\u5b83\u7684\u4efb\u4f55\u7f3a\u70b9\u3002\u6709\u8bda\u610f\uff0c\u624d\u80fd\u9707\u64bc\u4eba\u5fc3\u3002","type":3}],"country":"1","ctype":133,"from":1737,"id":"19480130729656","imgs":{"img":["http://t2.qpic.cn/mblogpic/26c7dd79bacfeaa89098"]},"musics":null,"ocontent":"\u300a\u5782\u76f4\u6781\u9650\u300b\uff0c\u591a\u5e74\u524d\u7684\u7ecf\u5178\u8001\u7247\u3002\u4ece\u5267\u60c5\u548c\u60c5\u611f\u5ba3\u6cc4\u4e0a\u770b\u662f\u6bd4\u8f83\u4fd7\u5957\u7684\uff0c\u6bd5\u7adf\u52b1\u5fd7\u8fd0\u52a8\u7684\u7c7b\u578b\u7247\u82b1\u6837\u5df2\u7ecf\u57fa\u672c\u73a9\u4e86\u4e2a\u904d\u3002\u4f46\u4e0d\u5f97\u4e0d\u8bf4\uff0c\u5f71\u7247\u5bf9\u4e8e\u8282\u594f\u7684\u628a\u63e1\uff0c\u5173\u952e\u8f6c\u6298\u70b9\u7684\u628a\u63e1\u662f\u529f\u529b\u975e\u51e1\u7684\u3002\u7528\u4e25\u9177\u7684\u73af\u5883\u3001\u6781\u9650\u7684\u6311\u6218\u3001\u6263\u4eba\u5fc3\u5f26\u7684\u6865\u6bb5\u6765\u63a9\u76d6\u672c\u8eab\u81ea\u5e26\u7684\u77eb\u60c5\uff0c\u5b8c\u5168\u53ef\u4ee5\u63a9\u9970\u5b83\u7684\u4efb\u4f55\u7f3a\u70b9\u3002\u6709\u8bda\u610f\uff0c\u624d\u80fd\u9707\u64bc\u4eba\u5fc3\u3002","province":"33","src":"\u817e\u8baf\u5fae\u535a","srcurl":"http://t.qq.com","status":0,"time":1345690620,"type":1,"videos":null,"votes":null},"uin":"302102ec64a5e266"},{"account":"hntvklns","flag1":129,"flag2":0,"follower":786910,"following":140,"idol":0,"nick":"2011\u5feb\u4e50\u5973\u58f0","portrait":"http://mbloghead.store.qq.com/mbloghead/1b6aa49e9f248d5b3320","tweet":null,"uin":"b7a3151f27017cb8"},{"account":"SportsGenius","flag1":129,"flag2":0,"follower":998333,"following":245,"idol":0,"nick":"\u4f53\u80b2\u7cbe\u7075","portrait":"http://t0.qlogo.cn/mbloghead/5a3f0739fc0429494f20","tweet":{"city":"","content":[{"con":"\u3010\u89c6\u9891\uff1a\u76d8\u70b9\u5965\u8fd0\u9009\u624b\u7684\u4f26\u6566\u68a6 \u5965\u6797\u5339\u514b\u4e3a\u4ed6\u4eec\u9f13\u638c\u3011\u53c2\u52a0","type":3},{"con":"\u4f26\u6566\u5965\u8fd0","type":0},{"con":"\u6bd4\u8d5b\u7684\u6709\u8d85\u8fc710500\u540d\u9009\u624b\uff0c\u800c\u5956\u724c\u53ea\u6709962\u679a\uff0c\u5982\u679c\u5965\u8fd0\u53ea\u6709\u5956\u724c\uff0c\u53ea\u6709\u6700\u529f\u5229\u7684\u6210\u7ee9\u6bd4\u62fc\uff0c\u90a3\u4e48\u6ca1\u6709\u83b7\u5956\u7684\u5176\u5b83\u4eba\u4f55\u5fc5\u52aa\u529b\u8bad\u7ec3\uff0c\u800c\u5e73\u51e1\u5982\u6211\u4eec\uff0c\u53c8\u4f55\u5fc5\u518d\u95f2\u6687\u65f6\uff0c\u5230\u4f53\u80b2\u573a\u6325\u6c57\u5982\u96e8\uff1f ","type":3},{"type":2,"url1":"http://url.cn/5zzq0I","url2":"http://url.cn/5zzq0I?type=1&amp;from=19&amp;s=1737&amp;f=2"},{"con":" ","type":3}],"country":"1","ctype":135,"from":1737,"id":"14461106230872","imgs":{"img":["http://t2.qpic.cn/mblogpic/c9cabab5df5fb86c014c"]},"musics":null,"ocontent":"\u3010\u89c6\u9891\uff1a\u76d8\u70b9\u5965\u8fd0\u9009\u624b\u7684\u4f26\u6566\u68a6 \u5965\u6797\u5339\u514b\u4e3a\u4ed6\u4eec\u9f13\u638c\u3011\u53c2\u52a0#\u4f26\u6566\u5965\u8fd0#\u6bd4\u8d5b\u7684\u6709\u8d85\u8fc710500\u540d\u9009\u624b\uff0c\u800c\u5956\u724c\u53ea\u6709962\u679a\uff0c\u5982\u679c\u5965\u8fd0\u53ea\u6709\u5956\u724c\uff0c\u53ea\u6709\u6700\u529f\u5229\u7684\u6210\u7ee9\u6bd4\u62fc\uff0c\u90a3\u4e48\u6ca1\u6709\u83b7\u5956\u7684\u5176\u5b83\u4eba\u4f55\u5fc5\u52aa\u529b\u8bad\u7ec3\uff0c\u800c\u5e73\u51e1\u5982\u6211\u4eec\uff0c\u53c8\u4f55\u5fc5\u518d\u95f2\u6687\u65f6\uff0c\u5230\u4f53\u80b2\u573a\u6325\u6c57\u5982\u96e8\uff1f http://url.cn/5zzq0I ","province":"11","src":"\u817e\u8baf\u5fae\u535a","srcurl":"http://t.qq.com","status":0,"time":1344800621,"type":1,"videos":null,"votes":null},"uin":"9c459055db241ad4"},{"account":"klnscs","flag1":129,"flag2":0,"follower":883878,"following":10,"idol":0,"nick":"2011\u5feb\u4e50\u5973\u58f0\u957f\u6c99\u5531\u533a","portrait":"http://mbloghead.store.qq.com/mbloghead/71fa3a3f96cce98aeb8a","tweet":{"city":"1","content":[{"con":"\u3010\u5168\u56fd20\u5f3a\u7a81\u56f4\u8d5b\u7b2c\u4e00\u573a\u3011 \u606d\u559c\u957f\u6c99\u5531\u533a","type":3},{"account":"lx0608CS","nick":"\u5218\u5ffb","ouin":"6ad1f037fb53ba12","type":1},{"con":" ","type":3},{"account":"yy0608cs","nick":"\u6768\u6d0b","ouin":"aa0836571e7766b3","type":1},{"con":" ","type":3},{"con":"@DL","type":3},{"con":"\u7ec4\u5408\u957f\u6c99\u5feb\u5973 ","type":3},{"account":"sxx0101cs","nick":"\u5b59\u6615\u6b23sxx_","ouin":"0d56c2d1b74364b2","type":1},{"con":" \u6210\u529f\u664b\u7ea7\u5168\u56fd20\u5f3a\uff01\uff01\uff01\uff01\uff01 \uff01\uff01\uff01\uff01\uff01 \uff01\uff01\uff01\uff01\uff01","type":3}],"country":"1","ctype":129,"from":3,"id":"22115031670363","imgs":null,"musics":null,"ocontent":"\u3010\u5168\u56fd20\u5f3a\u7a81\u56f4\u8d5b\u7b2c\u4e00\u573a\u3011 \u606d\u559c\u957f\u6c99\u5531\u533a@lx0608CS @yy0608cs @DL\u7ec4\u5408\u957f\u6c99\u5feb\u5973 @sxx0101cs \u6210\u529f\u664b\u7ea7\u5168\u56fd20\u5f3a\uff01\uff01\uff01\uff01\uff01 \uff01\uff01\uff01\uff01\uff01 \uff01\uff01\uff01\uff01\uff01","province":"43","src":"\u817e\u8baf\u5fae\u535a","srcurl":"","status":0,"time":1308413012,"type":1,"videos":null,"votes":null},"uin":"6acfc008c1d404ca"},{"account":"klnsgz1","flag1":129,"flag2":0,"follower":792113,"following":61,"idol":0,"nick":"2011\u5feb\u4e50\u5973\u58f0\u5e7f\u5dde\u5531\u533a","portrait":"http://mbloghead.store.qq.com/mbloghead/004180fc6b2e424200b8","tweet":{"city":"","content":[{"con":"\u3010\u5e7f\u5dde\u5531\u533a \u68a6\u60f3\u7efd\u653e\u3011","type":3},{"account":"zq0706gz","nick":"\u66fe\u7426zq_","ouin":"74929ec17407f8b7","type":1},{"con":" ","type":3},{"account":"ll0628gz","nick":"\u5218\u7433ll_","ouin":"3c3281a4acd267da","type":1},{"con":" ","type":3},{"account":"jyl0831gz","nick":"\u91d1\u94f6\u73b2","ouin":"f1745075d8aec4e1","type":1},{"con":" ","type":3},{"account":"SML0809gz","nick":"\u82cf\u5999\u73b2Wan","ouin":"b0ce263795b91dc3","type":1},{"con":" \u5e26\u77405000\u4e2a\u5e7f\u5dde\u5feb\u5973\u7684\u97f3\u4e50\u68a6\u60f3\u9a81\u52c7\u7a81\u56f4\uff0c\u633a\u8fdb\u5168\u56fd20\u5f3a\u3002","type":3}],"country":"1","ctype":133,"from":3,"id":"25115027288475","imgs":{"img":["http://t1.qpic.cn/mblogpic/d381708c8d1529d2fa28"]},"musics":null,"ocontent":"\u3010\u5e7f\u5dde\u5531\u533a \u68a6\u60f3\u7efd\u653e\u3011@zq0706gz @ll0628gz @jyl0831gz @SML0809gz \u5e26\u77405000\u4e2a\u5e7f\u5dde\u5feb\u5973\u7684\u97f3\u4e50\u68a6\u60f3\u9a81\u52c7\u7a81\u56f4\uff0c\u633a\u8fdb\u5168\u56fd20\u5f3a\u3002","province":"51","src":"\u817e\u8baf\u5fae\u535a","srcurl":"","status":0,"time":1308413195,"type":1,"videos":null,"votes":null},"uin":"2100512482d40dcf"},{"account":"xuz11O","flag1":129,"flag2":0,"follower":264936,"following":1825,"idol":0,"nick":"\u5f90\u5dde110","portrait":"http://t0.qlogo.cn/mbloghead/589ed3f2f4a12c4cd47c","tweet":{"city":"3","content":[{"con":"7\u670831\u65e5\uff0c\u6211\u5c40\u6307\u6325\u4e2d\u5fc3\u7ed3\u5408","type":3},{"con":"\u56db\u5fb7\u4e3b\u9898\u6559\u80b2\u6d3b\u52a8","type":0},{"con":"\u6df1\u5165\u6cc9\u5c71\u533a\u4f59\u7a91\u793e\u533a\u5f00\u5c55","type":3},{"con":"\u4e09\u89e3\u4e09\u4fc3","type":0},{"con":"\u6d3b\u52a8\uff0c\u770b\u671b\u6170\u95ee\u8001\u515a\u5458\u548c\u7279\u56f0\u7fa4\u4f17\uff0c\u540c\u65f6\u6536\u96c6\u793e\u533a\u7fa4\u4f17\u5bf9\u516c\u5b89\u673a\u5173\u8b66\u52a1\u5de5\u4f5c\u7684\u610f\u89c1\u5efa\u8bae\u3002","type":3}],"country":"1","ctype":133,"from":1737,"id":"117268081471115","imgs":{"img":["http://t3.qpic.cn/mblogpic/9ac22614137d4f4ef034"]},"musics":null,"ocontent":"7\u670831\u65e5\uff0c\u6211\u5c40\u6307\u6325\u4e2d\u5fc3\u7ed3\u5408#\u56db\u5fb7\u4e3b\u9898\u6559\u80b2\u6d3b\u52a8#\u6df1\u5165\u6cc9\u5c71\u533a\u4f59\u7a91\u793e\u533a\u5f00\u5c55#\u4e09\u89e3\u4e09\u4fc3#\u6d3b\u52a8\uff0c\u770b\u671b\u6170\u95ee\u8001\u515a\u5458\u548c\u7279\u56f0\u7fa4\u4f17\uff0c\u540c\u65f6\u6536\u96c6\u793e\u533a\u7fa4\u4f17\u5bf9\u516c\u5b89\u673a\u5173\u8b66\u52a1\u5de5\u4f5c\u7684\u610f\u89c1\u5efa\u8bae\u3002","province":"32","src":"\u817e\u8baf\u5fae\u535a","srcurl":"http://t.qq.com","status":0,"time":1343803744,"type":1,"videos":null,"votes":null},"uin":"20cdbcdb29f691f1"},{"account":"shanxidushi110","flag1":129,"flag2":0,"follower":501318,"following":468,"idol":0,"nick":"\u5c71\u897f\u90fd\u5e02110","portrait":"http://t1.qlogo.cn/mbloghead/ae753ff6952a6171d654","tweet":{"city":"1","content":[{"con":"7\u670810\u53f7\u957f\u6cbb\u5e02\u4e2d\u7ea7\u4eba\u6c11\u6cd5\u9662\u5bf9\u5c0f\u6f47\u7136\u88ab\u8650\u6848\u8fdb\u884c\u4e86\u4e00\u5ba1  \u4eca\u5929\u4e0a\u5348\u957f\u6cbb\u5e02\u4e2d\u7ea7\u4eba\u6c11\u6cd5\u9662\u5bf9\u6b64\u6848\u8fdb\u884c\u4e86\u4e00\u5ba1\u5ba3\u5224  \u4eca\u5929\u4e00\u5ba1\u5ba3\u5224\u4f1a\u7ed3\u679c\u4f1a\u662f\u4ec0\u4e48\uff1f \u9762\u5bf9\u4e00\u5ba1\u5224\u51b3\uff0c\u674e\u8273\u7434\u662f\u5426\u4f1a\u63d0\u51fa\u4e0a\u8bc9\u7533\u8bf7\uff1f \u656c\u8bf7\u5173\u6ce8\u4eca\u665a\u90fd\u5e02110 \u5c0f\u6f47\u7136\u88ab\u8650\u81f4\u6b7b\u6848\u4ef6\u6700\u65b0\u62a5\u9053\u3002","type":3}],"country":"1","ctype":133,"from":1737,"id":"19831128348182","imgs":{"img":["http://t3.qpic.cn/mblogpic/fe0e87ad9e0c53cc85c0"]},"musics":null,"ocontent":"7\u670810\u53f7\u957f\u6cbb\u5e02\u4e2d\u7ea7\u4eba\u6c11\u6cd5\u9662\u5bf9\u5c0f\u6f47\u7136\u88ab\u8650\u6848\u8fdb\u884c\u4e86\u4e00\u5ba1  \u4eca\u5929\u4e0a\u5348\u957f\u6cbb\u5e02\u4e2d\u7ea7\u4eba\u6c11\u6cd5\u9662\u5bf9\u6b64\u6848\u8fdb\u884c\u4e86\u4e00\u5ba1\u5ba3\u5224  \u4eca\u5929\u4e00\u5ba1\u5ba3\u5224\u4f1a\u7ed3\u679c\u4f1a\u662f\u4ec0\u4e48\uff1f \u9762\u5bf9\u4e00\u5ba1\u5224\u51b3\uff0c\u674e\u8273\u7434\u662f\u5426\u4f1a\u63d0\u51fa\u4e0a\u8bc9\u7533\u8bf7\uff1f \u656c\u8bf7\u5173\u6ce8\u4eca\u665a\u90fd\u5e02110 \u5c0f\u6f47\u7136\u88ab\u8650\u81f4\u6b7b\u6848\u4ef6\u6700\u65b0\u62a5\u9053\u3002","province":"14","src":"\u817e\u8baf\u5fae\u535a","srcurl":"http://t.qq.com","status":0,"time":1343880116,"type":1,"videos":null,"votes":null},"uin":"dc23ef3cd8c228b5"},{"account":"tx1950001321","flag1":129,"flag2":0,"follower":395,"following":100,"idol":0,"nick":"11","portrait":"http://t1.qlogo.cn/mbloghead/bece614cfd3e6dae419a","tweet":{"city":"","content":[{"con":"\u6dfb\u52a0\u4e86\u5e94\u7528 \u3010\u957f\u5fae\u535a\u5de5\u5177\u3011  ","type":3},{"type":2,"url1":"http://url.cn/0fLGtn","url2":"http://url.cn/0fLGtn?type=1&amp;from=19&amp;s=50001894&amp;f=2"},{"con":" ","type":3}],"country":"","ctype":131,"from":50001894,"id":"84428018307924","imgs":null,"musics":null,"ocontent":"\u6dfb\u52a0\u4e86\u5e94\u7528 \u3010\u957f\u5fae\u535a\u5de5\u5177\u3011  http://url.cn/0fLGtn ","province":"","src":"\u817e\u8baf\u5fae\u535a","srcurl":"http://t.qq.com","status":0,"time":1345530915,"type":1,"videos":null,"votes":null},"uin":"6cd2c0a02dabc787"},{"account":"esports5211","flag1":129,"flag2":0,"follower":21777,"following":79,"idol":0,"nick":"11\u5bf9\u6218\u5e73\u53f0","portrait":"http://t1.qlogo.cn/mbloghead/7372c729a141524ad8b8","tweet":{"city":"","content":[{"con":"\u5f53\u6211\u4eec\u7684\u5728\u7ebf\u5ba2\u670d\u5168\u65b0\u6539\u7248\u4e4b\u540e\uff0c\u7ed9\u73a9\u5bb6\u63d0\u4f9b\u4e86\u66f4\u65b9\u4fbf\uff0c\u66f4\u5feb\u6377\u7684\u4e3e\u62a5\u5916\u6302\u548c\u5237\u5206\u7684\u5730\u65b9\u3002\u4e5f\u611f\u8c22\u73a9\u5bb6\u79ef\u6781\u4e3e\u62a5\u5916\u6302\u3002 \u6211\u4eec\u4e0d\u80fd\u505a\u5230100% \u6ca1\u6709\u5916\u6302\uff0c\u4f46\u662f\u6211\u4eec\u4fdd\u8bc1\uff0c\u4e00\u5b9a\u8981\u4e0e\u5916\u6302\u505a\u7edd\u5bf9\u7684\u6597\u4e89\uff01 \u611f\u8c22\u5404\u4f4d\u73a9\u5bb6\u4e00\u8def\u4e0e\u6211\u4eec\u540c\u884c\u3002  \u6253\u51fb\u5916\u6302\uff0c\u4eba\u4eba\u6709\u8d23\uff01","type":3}],"country":"1","ctype":133,"from":1737,"id":"132644016578374","imgs":{"img":["http://t1.qpic.cn/mblogpic/374b23908313561ae180"]},"musics":null,"ocontent":"\u5f53\u6211\u4eec\u7684\u5728\u7ebf\u5ba2\u670d\u5168\u65b0\u6539\u7248\u4e4b\u540e\uff0c\u7ed9\u73a9\u5bb6\u63d0\u4f9b\u4e86\u66f4\u65b9\u4fbf\uff0c\u66f4\u5feb\u6377\u7684\u4e3e\u62a5\u5916\u6302\u548c\u5237\u5206\u7684\u5730\u65b9\u3002\u4e5f\u611f\u8c22\u73a9\u5bb6\u79ef\u6781\u4e3e\u62a5\u5916\u6302\u3002 \u6211\u4eec\u4e0d\u80fd\u505a\u5230100% \u6ca1\u6709\u5916\u6302\uff0c\u4f46\u662f\u6211\u4eec\u4fdd\u8bc1\uff0c\u4e00\u5b9a\u8981\u4e0e\u5916\u6302\u505a\u7edd\u5bf9\u7684\u6597\u4e89\uff01 \u611f\u8c22\u5404\u4f4d\u73a9\u5bb6\u4e00\u8def\u4e0e\u6211\u4eec\u540c\u884c\u3002  \u6253\u51fb\u5916\u6302\uff0c\u4eba\u4eba\u6709\u8d23\uff01","province":"31","src":"\u817e\u8baf\u5fae\u535a","srcurl":"http://t.qq.com","status":0,"time":1345707303,"type":1,"videos":null,"votes":null},"uin":"a9f1ecf04502d4f9"},{"account":"zhangchi1011","flag1":1,"flag2":2,"follower":218848,"following":137,"idol":0,"nick":"1011\u5f20\u6301","portrait":"http://t0.qlogo.cn/mbloghead/565ca1f93ddf2c063ad4","tweet":{"city":"1","content":[{"con":"\u804c\u573a\u53d8\u806a\u660e\u7684\u7b80\u4fbf\u505a\u6cd5\uff1a1\u3001\u628a\u88c5B\u7684\u52b2\u513f\u6362\u6210\u88c5\u7cca\u6d82\uff1b2\u3001\u628a\u5439\u725b\u7684\u8bdd\u7528\u5230\u522b\u4eba\u8eab\u4e0a\uff1b3\u3001\u628a\u8eab\u8fb9\u7684\u4eba\u5f52\u4e3a\u559c\u6b22\u548c\u4e0d\u559c\u6b22\u4e24\u7c7b\uff0c\u4e0d\u8981\u8bbe\u7f6e\u201c\u8ba8\u538c\u201d\u8fd9\u4e2a\u7c7b\u522b\uff1b4\u3001\u9762\u5bf9\u6d41\u8a00\u4e0d\u89e3\u91ca\uff0c\u9762\u5bf9\u8bef\u4f1a\u4e0d\u4e89\u8fa9\uff0c\u4f60\u53ea\u9700\u8981\u5634\u89d2\u4e0a\u626c\u4e00\u4e0b\u5373\u53ef\uff1b5\u3001\u8bf4\u8bdd\u5c31\u662f\u8bf4\u8bdd\u4e0d\u8981\u8c08\u5fc3\uff1b6\u3001\u81ea\u5df1\u7684\u9690\u79c1\u4e0d\u8981\u5916\u6f0f\uff0c\u81ea\u5df1\u7684\u8106\u5f31\u653e\u5230\u5bb6\u91cc\uff1b7\u3001\u8f6c\u53d1\u6b64\u5fae\u535a\u3002","type":3}],"country":"1","ctype":129,"from":1737,"id":"50443015766229","imgs":null,"musics":null,"ocontent":"\u804c\u573a\u53d8\u806a\u660e\u7684\u7b80\u4fbf\u505a\u6cd5\uff1a1\u3001\u628a\u88c5B\u7684\u52b2\u513f\u6362\u6210\u88c5\u7cca\u6d82\uff1b2\u3001\u628a\u5439\u725b\u7684\u8bdd\u7528\u5230\u522b\u4eba\u8eab\u4e0a\uff1b3\u3001\u628a\u8eab\u8fb9\u7684\u4eba\u5f52\u4e3a\u559c\u6b22\u548c\u4e0d\u559c\u6b22\u4e24\u7c7b\uff0c\u4e0d\u8981\u8bbe\u7f6e\u201c\u8ba8\u538c\u201d\u8fd9\u4e2a\u7c7b\u522b\uff1b4\u3001\u9762\u5bf9\u6d41\u8a00\u4e0d\u89e3\u91ca\uff0c\u9762\u5bf9\u8bef\u4f1a\u4e0d\u4e89\u8fa9\uff0c\u4f60\u53ea\u9700\u8981\u5634\u89d2\u4e0a\u626c\u4e00\u4e0b\u5373\u53ef\uff1b5\u3001\u8bf4\u8bdd\u5c31\u662f\u8bf4\u8bdd\u4e0d\u8981\u8c08\u5fc3\uff1b6\u3001\u81ea\u5df1\u7684\u9690\u79c1\u4e0d\u8981\u5916\u6f0f\uff0c\u81ea\u5df1\u7684\u8106\u5f31\u653e\u5230\u5bb6\u91cc\uff1b7\u3001\u8f6c\u53d1\u6b64\u5fae\u535a\u3002","province":"61","src":"\u817e\u8baf\u5fae\u535a","srcurl":"http://t.qq.com","status":0,"time":1345444522,"type":1,"videos":null,"votes":null},"uin":"37a4dc54183a6fa5"},{"account":"wangpandada","flag1":129,"flag2":0,"follower":479110,"following":3,"idol":0,"nick":"115\u7f51\u76d8","portrait":"http://t0.qlogo.cn/mbloghead/b4b99d976d28f082d8d2","tweet":null,"uin":"a8821892f92cf008"},{"account":"klnshz","flag1":129,"flag2":0,"follower":564881,"following":12,"idol":0,"nick":"2011\u5feb\u4e50\u5973\u58f0\u676d\u5dde\u5531\u533a","portrait":"http://mbloghead.store.qq.com/mbloghead/2bf5ddbee69e26a71044","tweet":{"city":"1","content":[{"con":"\u606d\u559c\u6210\u529f\u664b\u7ea7\u5168\u56fd20\u5f3a\u7684\u676d\u5dde\u9009\u624b\uff01@\u6d2a\u8fb0\u676d\u5dde\u5feb\u5973 ","type":3},{"account":"ctq0617hz","nick":"\u5d14\u5929\u742actq_","ouin":"3898f442105d7447","type":1},{"con":" ","type":3},{"account":"fmn0625hz","nick":"\u4ed8\u68a6\u59ae","ouin":"f010dabfe98ee158","type":1},{"con":" ","type":3},{"account":"wj0725hz","nick":"\u6587\u9759wj_","ouin":"d2c27334df07ffde","type":1},{"con":" \u5e26\u7740\u5176\u4ed6\u59d0\u59b9\u4eec\u7684\u68a6\u60f3\u7ee7\u7eed\u524d\u8fdb\u5427\uff01\uff01\u4f60\u4eec\u6700\u68d2\uff01\uff01","type":3}],"country":"1","ctype":129,"from":3,"id":"9115114072028","imgs":null,"musics":null,"ocontent":"\u606d\u559c\u6210\u529f\u664b\u7ea7\u5168\u56fd20\u5f3a\u7684\u676d\u5dde\u9009\u624b\uff01@\u6d2a\u8fb0\u676d\u5dde\u5feb\u5973 @ctq0617hz @fmn0625hz @wj0725hz \u5e26\u7740\u5176\u4ed6\u59d0\u59b9\u4eec\u7684\u68a6\u60f3\u7ee7\u7eed\u524d\u8fdb\u5427\uff01\uff01\u4f60\u4eec\u6700\u68d2\uff01\uff01","province":"43","src":"\u817e\u8baf\u5fae\u535a","srcurl":"","status":0,"time":1308500881,"type":1,"videos":null,"votes":null},"uin":"ba890465937eee77"},{"account":"baby_xiao11","flag1":513,"flag2":2,"follower":13272,"following":384,"idol":0,"nick":"\u5c0f11","portrait":"http://t0.qlogo.cn/mbloghead/259710592d52cde2d0ac","tweet":{"city":"1","content":[{"con":"\u4eba\u751f\u7b2c\u4e00\u6b21\u4e03\u5915\u6536\u5230\u82b1/\u53ef\u7231\uff0cby the way \uff0c/\u5c34\u5c2c\u4e03\u5915\u82b1\u597d\u8d35\u554a","type":3}],"country":"1","ctype":133,"from":6,"id":"68433047570862","imgs":{"img":["http://t2.qpic.cn/mblogpic/ffb331fc531f378e1884"]},"musics":null,"ocontent":"\u4eba\u751f\u7b2c\u4e00\u6b21\u4e03\u5915\u6536\u5230\u82b1/\u53ef\u7231\uff0cby the way \uff0c/\u5c34\u5c2c\u4e03\u5915\u82b1\u597d\u8d35\u554a","province":"33","src":"iPhone","srcurl":"","status":0,"time":1345723374,"type":1,"videos":null,"votes":null},"uin":"a442aef576535afa"},{"account":"zhaott1128","flag1":1,"flag2":0,"follower":214442,"following":79,"idol":0,"nick":"\u8d75\u5a77\u5a771128","portrait":"http://mbloghead.store.qq.com/mbloghead/96c81f27ef0eed84aa4a","tweet":{"city":"1","content":[{"con":"\u65b0\u7586\u70e4\u5168\u7f8a\uff0c\u5927\u53e3\u5403\u8089\u5927\u53e3\u559d\u9152O(\u2229_\u2229)O\u54c8\u54c8~","type":3}],"country":"1","ctype":133,"from":1011594,"id":"129142102366149","imgs":{"img":["http://t2.qpic.cn/mblogpic/8f1091bba85ef420a344"]},"musics":null,"ocontent":"\u65b0\u7586\u70e4\u5168\u7f8a\uff0c\u5927\u53e3\u5403\u8089\u5927\u53e3\u559d\u9152O(\u2229_\u2229)O\u54c8\u54c8~","province":"65","src":"\u817e\u8baf\u5fae\u535a","srcurl":"http://t.qq.com","status":0,"time":1345645740,"type":1,"videos":null,"votes":null},"uin":"10697f96edc3ca7c"}],"total":36274102},"recommendhts":{"recommendht":[{"favi":0,"id":"915087899214126078","name":"-11","twnum":49,"type":0},{"favi":7068,"id":"-7624419193327323672","name":"2011.11.11\u6211\u4eec\u7ed3\u5a5a\u5427---QQ\u7968\u52a1","twnum":36897,"type":0},{"favi":1,"id":"-4915983158922744740","name":"11.","twnum":12,"type":0},{"favi":31,"id":"-2258895128586546587","name":"11","twnum":4346,"type":0},{"favi":4439,"id":"-1242447426986819085","name":"57\u4e0711\u5c4a\u5927\u5b66\u751f\u5931\u4e1a","twnum":136523,"type":0}],"total":3090},"result":{"code":0,"msg":"get data success","now":1345796413}});

 

{"account":"hunantv2011","flag1":129,"flag2":0,"follower":1069530,"following":32,"idol":0,"nick":"2011\u6e56\u5357\u6625\u665a","portrait":"http://mbloghead.store.qq.com/mbloghead/97855424cac575e8bc14"

求高手指点一下另一个关于正则表达式的问题,内容如上,我想取出其中的每一个

"account"后面紧跟着的账号,以及
"nick": 后面紧跟的一串字符串,
如上所示的:account: hunantv2011
nick:"2011\u6e56\u5357\u6625\u665a"
老虎下山 | 园豆:43 (初学一级) | 2012-08-24 22:14
其他回答(3)
0

请问需要空间密码的能采集吗?用什么方式?

收获园豆:60
编程笔记 | 园豆:107 (初学一级) | 2012-08-03 12:43
1

最近很奇怪啊,为啥发现好多问题是问,把 html post 到服务器上,然后需要用正则 取出 html 里面的东西,

为啥不在客户端,直接用 jq 选择器取好,做成 json ,然后 post 呢?

张坤 | 园豆:1865 (小虾三级) | 2012-08-03 12:54

这些就直接从服务器上get下来的数据,需要二次开发使用。

支持(0) 反对(0) 老虎下山 | 园豆:43 (初学一级) | 2012-08-03 12:58

@老虎下山: 

(?<=blogtitle_)\d+(?=\\) 能取出  blogtitle_  和 \ 之间的数字

(?<=blogtitle_.*?>).*(?=</span>) 能取出包含 blogtitle 标签中的内容

 

正则写的比较锉,哈哈

支持(0) 反对(0) 张坤 | 园豆:1865 (小虾三级) | 2012-08-03 13:09

@张坤: 呵呵,还是不错的。第一个可以成功取出ID号,但是第二取出标题的正则无法实现哦。

支持(0) 反对(0) 老虎下山 | 园豆:43 (初学一级) | 2012-08-03 14:00

@老虎下山: (?=<span id=\\"blogtitle_\d+\\" >).*?(?=</span>)

酱紫再试试,哈哈

支持(0) 反对(0) 张坤 | 园豆:1865 (小虾三级) | 2012-08-03 15:04

@张坤: 可以取出值 ,但是多了前面一部分。怎么去除呢。

测试到的结果:<span id=\"blogtitle_1338208697\" >        title      
<span id=\"blogtitle_1343713117\" >        黑马QQ群营销大师软件营销效果分析      
<span id=\"blogtitle_1343712578\" >        名间特效胃药-胃宁      
<span id=\"blogtitle_1343712001\" >        走在一起是缘份,一起在走是幸福      
<span id=\"blogtitle_1343711473\" >        千米QQ空间营销软件常用广告--图片超级链接代码分享(广告必备)      

支持(0) 反对(0) 老虎下山 | 园豆:43 (初学一级) | 2012-08-03 16:46

@老虎下山: 是的,我没处理内容的开头和结尾 空格,你 trim 下!

支持(0) 反对(0) 张坤 | 园豆:1865 (小虾三级) | 2012-08-03 16:50

@张坤: 后面的空白还好处理,可是前面部分多的不单单是空格。是多出了一串“<span id=\"blogtitle_1343711473\" >       ” 这个字符串。呵呵。

支持(0) 反对(0) 老虎下山 | 园豆:43 (初学一级) | 2012-08-03 17:17

@老虎下山: 不会的啊,我用的 零宽断言,前面那段只是匹配位置,不占据内容啊,你那边检查下!

支持(0) 反对(0) 张坤 | 园豆:1865 (小虾三级) | 2012-08-03 17:20

@张坤: 怪事了,反复测试。包括用工具测试都会有前面那一部分内容出现的。呵呵

支持(0) 反对(0) 老虎下山 | 园豆:43 (初学一级) | 2012-08-03 17:31

@老虎下山: 

好吧 ,我反2了 ,是我弄错了,少了一个字符,

(?<=<span id=\\"blogtitle_\d+\\" >).*?(?=</span>)

 

少了红色字符,不好意思,耽误你时间啦!

支持(1) 反对(0) 张坤 | 园豆:1865 (小虾三级) | 2012-08-03 17:34

@张坤: 呵呵,客气了。谢谢你的解答。已经成功取到值了。

支持(0) 反对(0) 老虎下山 | 园豆:43 (初学一级) | 2012-08-03 17:41
-1

@"<([a-z]+)(?:(?!id)[^<>])*id=([""']?)blogtitle_(\d+?)\2[^>]*>([\s\S]+?)</\1>

咔咔 | 园豆:204 (菜鸟二级) | 2012-08-03 13:49

无法取到有效值……

支持(0) 反对(0) 老虎下山 | 园豆:43 (初学一级) | 2012-08-03 14:04

@老虎下山: 可以的,我试过

支持(0) 反对(0) 咔咔 | 园豆:204 (菜鸟二级) | 2012-08-04 10:01
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册