html标签如下:
<div id="content_left">
<div class="result c-container " id="1" srcid="1599" tpl="se_com_default" data-click="{"rsv_bdr":"0","rsv_cd":"pt:40520|vLevel:3","p5":1}"><h3 class="t"><a data-click="{
'F':'778717EA',
'F1':'9D73F1E4',
'F2':'4CA6DE6B',
'F3':'54E5243F',
'T':'1429179240',
'y':'37DCEFFD'
}" href="http://www.baidu.com/link?url=qACtFe5IWe267hSUPr_ggzyp_uZXYJm15uE1SBbsmOD6O4OxQpiKxe_h2vliicIPo0dXSRsb22jDBYTiRuNPya" target="_blank"><em>大观园</em>,北京<em>大观园</em>攻略/地址/图片/门票 </a></h3><div class="c-row c-gap-top-small"><div class="general_image_pic c-span6"><a class="c-img6" style="height:75px" href="http://www.baidu.com/link?url=qACtFe5IWe267hSUPr_ggzyp_uZXYJm15uE1SBbsmOD6O4OxQpiKxe_h2vliicIPo0dXSRsb22jDBYTiRuNPya" target="_blank"><img class="c-img c-img6" src="https://ss0.baidu.com/73F1bjeh1BF3odCf/it/u=1858918998,1966881607&fm=96&s=04F478845E5538CE6A3051900300508A" style="height:75px;"></a></div><div class="c-span18 c-span-last"><div class="c-abstract"><em>大观园</em>是一座再现中国古典文学名著《红楼梦》中“<em>大观园</em>”景观的仿古园林,原址为明清两代皇家菜园,明代曾在此设“嘉疏署”。1984年为拍摄电视剧《红楼梦》,经红学...</div><div class="f13"><span class="g"><b>you.ctrip.com</b>/sight/be... </span><div class="c-tools" id="tools_14720738737438748258_1" data-tools="{"title":"大观园,北京大观园攻略/地址/图片/门票 ","url":"http://www.baidu.com/link?url=qACtFe5IWe267hSUPr_ggzyp_uZXYJm15uE1SBbsmOD6O4OxQpiKxe_h2vliicIPo0dXSRsb22jDBYTiRuNPya"}"><a class="c-tip-icon"><i class="c-icon c-icon-triangle-down-g"></i></a></div><span class="c-icons-outer"><span class="c-icons-inner"><span class="c-vline"></span><span class="c-trust-as vstar" data_key="2329391299344843614" hint-data="{"label":"携程旅游信息技术上海有限公司","url":"http://www.baidu.com/s?wd=you.ctrip.com@v&vmp_ec=41cc6213a4a6ff570ab07476aC55d8fsHdJae94ej2ac29=b05b64Jlp9Sjv30X2dX3d7d4a47945d4c&vmp_ectm=1429156070&from=vs","hint":[{"txt":"[ecard 99]","vlevel":"3"}]}" hint-type="vstar" render="render"><a href="http://www.baidu.com/s?wd=you.ctrip.com@v&vmp_ec=41cc6213a4a6ff570ab07476aC55d8fsHdJae94ej2ac29=b05b64Jlp9Sjv30X2dX3d7d4a47945d4c&vmp_ectm=1429156070&from=vs" class="c-icon c-icon-v c-icon-v3" target="_blank" data-click="{'title':'vstar','rsv_vlevel':'3'}"></a></span></span></span> - <a data-click="{'rsv_snapshot':'1'}" href="http://cache.baiducontent.com/c?m=9d78d513d9d431a94f9995697d1dc010694381132ba1d6020fd68448e22f0606506793ac27550705a3943a275aed5e5d9ae73605200250e6c6979c0d9de59d7269ce6523716f9b5c598e5eb8cb31748760cb18feaf6eb6e7af2fd2f587899949039d085d21dca588470015c078f0636ba5f9c7&p=8473c64ad4b12dff57ed977542089f&newp=806ec54ad6c04af72aa7c7710f5193231610db2151d2d21427a6d9&user=baidu&fm=sc&query=%B4%F3%B9%DB%D4%B0+you%2Ectrip%2Ecom&qid=e8fd757f0000f5e4&p1=1" target="_blank" class="m">百度快照</a></div></div></div><div class="c-gap-top c-recommend" style="display:none;" data-extquery="北京大观园门票价格 北京大观园好玩吗 北京大观园图片 "><i class="c-icon c-icon-bear-circle c-gap-right-small"></i><span class="c-gray">为您推荐:</span><a href="/s?tn=baiduhome_pg&wd=%E5%8C%97%E4%BA%AC%E5%A4%A7%E8%A7%82%E5%9B%AD%E9%97%A8%E7%A5%A8%E4%BB%B7%E6%A0%BC&rsv_idx=2&ie=utf-8&rsv_crq=7&bs=%E5%A4%A7%E8%A7%82%E5%9B%AD+you.ctrip.com" target="_blank" class="res-gap-right16">北京大观园门票价格</a><a href="/s?tn=baiduhome_pg&wd=%E5%8C%97%E4%BA%AC%E5%A4%A7%E8%A7%82%E5%9B%AD%E5%A5%BD%E7%8E%A9%E5%90%97&rsv_idx=2&ie=utf-8&rsv_crq=7&bs=%E5%A4%A7%E8%A7%82%E5%9B%AD+you.ctrip.com" target="_blank" class="res-gap-right16">北京大观园好玩吗</a><a href="/s?tn=baiduhome_pg&wd=%E5%8C%97%E4%BA%AC%E5%A4%A7%E8%A7%82%E5%9B%AD%E5%9B%BE%E7%89%87&rsv_idx=2&ie=utf-8&rsv_crq=7&bs=%E5%A4%A7%E8%A7%82%E5%9B%AD+you.ctrip.com" target="_blank">北京大观园图片</a></div></div>
</div>
需要获取<div id="content_left">中第一条数据,即:id=“1”的div中的
1)<h3>标题,即:<em>大观园</em>,北京<em>大观园</em>攻略/地址/图片/门票
2)<h3><a>的链接:即:http://www.baidu.com/link?url=qACtFe5IWe267hSUPr_ggzyp_uZXYJm15uE1SBbsmOD6O4OxQpiKxe_h2vliicIPo0dXSRsb22jDBYTiRuNPya
3)快照地址:<span class="g"><b>you.ctrip.com</b>/sight/be... </span>,
即:<b>you.ctrip.com</b>/sight/be...
实际是获取<div id="content_left">中第一条数据,即:id=“1”的div中的内容,求正则表达式大神么赐教哦~~!
<div[^<]*id="content_left"[^<]*>.*?<div[^<]*id="\d+"[^<]*>.*?<h3[^<]*>[^<]*<a[^<]*href="(.*?)"[^<]*>(.*?)</a>[^<]*</h3>.*?<span[^<]*class="g"[^<]*>(.*?)</span>.*?
从group中取
好厉害啊,正则表达式是怎么学习的哦,我都没看不懂。
太乱,不爱看
虽然没看懂,但看起来很厉害的样子。