日期:2014-05-17  浏览次数:20833 次

Html源码中的反斜杠解析问题
我想解析一个新浪微博网页的源码,也就是在网页上我们点击“查看源码”得到的页面,部分如下:
<a href=\"http:\/\/weibo.com\/u\/2314569344\" title=\"jasminezs\" target=\"_blank\" suda-data=\"key=tblog_search_v4.1&value=:2314569344\">\n <img src=\"http:\/\/tp1.sinaimg.cn\/2314569344\/50\/40038951937\/0\" alt=\"jasminezs\" width=\"50\" height=\"50\" \/>\n  <\/a>\n <\/dt>\n <dd class=\"content\">\n  <p node-type=\"feed_list_content\">\n <a nick-name=\"jasminezs\" href=\"http:\/\/weibo.com\/u\/2314569344\" target=\"_blank\" title=\"jasminezs\" suda-data=\"key=tblog_search_v4.1&value=:2314569344\">jasminezs<a target=\"_blank\" href=\"http:\/\/club.weibo.com\/intro\"><img src=\"http:\/\/img.t.sinajs.cn\/t4\/style\/images\/common\/transparent.gif\" title= \"\u5fae\u535a\u8fbe\u4eba\" alt=\"\u5fae\u535a\u8fbe\u4eba\" class=\"ico_club\" node-type=\"daren\"\/><\/a><\/a>\uff1a<em><a class=\"a_topic\" href=\"http:\/\/huati.weibo.com\/k\/%E5%8C%97%E4%BA%AC%E5%9C%B0%E9%93%81%E8%B0%83%E4%BB%B7?from=526\" target=\"_blank\">#<span style=\"color:red;\">\u5317\u4eac\u5730\u94c1\u8c03\u4ef7<\/span>#<\/a>\u88ab\u4ea4\u901a\u5c40\u8822\u54ed\u4e86\u597d\u5417\uff1f\u6709\u6728\u6709\u641e\u9519\uff0c\u5730\u94c1\u8c03\u4ef7\u4f60\u8ba9\u82e6\u903c\u4e0a\u73ed\u65cf\u600e\u4e48\u6d3b\uff1f\uff01\u4e0d\u77e5\u9053\u73b0\u5728\u5317\u4eac\u96fe\u973e\u8fd9\u4e48\u4e25\u91cd\uff0c\u5730\u94c1\u8c03\u4ef7\u5f00\u8f66\u4eba\u4f1a\u66f4\u591a\uff0c\u516c\u4ea4\u4e5f\u4f1a\u53d7\u5f71\u54cd\u597d\u5417\uff1f\u4e00\u70b9\u611f\u53d7\u4e0d\u5230\u5927\u57ce\u5e02\u7684\u4eba\u6027\u3002\u3002\u3002\u7275\u4e00\u53d1\u800c\u52a8\u5168\u8eab\uff0c\u9a6c\u514b\u601d\u4e3b\u4e49\u6ef4\u8054\u7cfb\u7684\u89c2\u70b9\u90fd\u5b66\u54ea\u513f\u53bb\u4e86\uff1f\uff01\uff01\u3002\u3002\u3002\u3002sign\u3002\u3002\u3002\u3002over<\/em>\n  <\/p>\n <p class=\"info W_linkb W_textb\">\n <span>\n    

这里,<\/a>和<\/em>中的UTF-8信息时我要获取的,也就这一段“<\/a>\u88ab\u4ea4\u901a\u5c40\u8822\u54ed\u4e86\u597d\u5417\uff1f\u6709\u6728\u6709\u641e\u9519\uff0c\u5730\u94c1\u8c03\u4ef7\u4f60\u8ba9\u82e6\u903c\u4e0a\u73ed\u65cf\u600e\u4e48\u6d3b\uff1f\uff01\u4e0d\u77e5\u9053\u73b0\u5728\u5317\u4eac\u96fe\u973e\u8fd9\u4e48\u4e25\u91cd\uff0c\u5730\u94c1\u8c03\u4ef7\u5f00\u8f66\u4eba\u4f1a\u66f4\u591a\uff0c\u516c\u4ea4\u4e5f\u4f1a\u53d7\u5f71\u54cd\u597d\u5417\uff1f\u4e00\u70b9\u611f\u53d7\u4e0d\u5230\u5927\u57ce\u5e02\u7684\u4eba\u6027\u3002\u3002\u3002\u7275\u4e00\u53d1\u800c\u52a8\u5168\u8eab\uff0c\u9a6c\u514b\u601d\u4e3b\u4e49\u6ef4\u8054\u7cfb\u7684\u89c2\u70b9\u90fd\u5b66\u54ea\u513f\u53bb\u4e86\uff1f\uff01\uff01\u3002\u3002\u3002\u3002sign\u3002\u3002\u3002\u3002over<\/em>”。
可是我无法用正则匹配得到这一段,在处理中反斜杠问题不知道怎么解决。
因为如果把这一段赋给一个字符串,是会出错的,字符串中的\必须为\\。请问如何提取出我需要的这段文字呢?