<div class="sw2"><div class='swz'>552401</div><div class="swa">[<a href="http://all.qidian.com/book/bookstore.aspx?ChannelId=7" class="hui2">游戏</a>/<a href="http://all.qidian.com/book/bookstore.aspx?ChannelId=7&SubCategoryId=70" class="hui2">虚拟网游</a>]</div><div class="swb"><span class="swbt"><a href="/Book/10027.aspx" target="_blank">网络贱圣</a> </span><a href="/BookReader/10027,626679.aspx" target="_blank" class="hui2">第一部 贱圣开始了 第十二章 小心!贱招</a> </div> <div class="swc">92835</div><div class="swd"><a href="http://me.qidian.com/authorIndex.aspx?id=3091" target="_blank" class="black">地狱爱琴海</a></div> <div class="swe">05-03-17 11:07</div> </div><div class="sw1"><div class='swz'>552402</div><div class="swa">[<a href="http://all.qidian.com/book/bookstore.aspx?ChannelId=21" class="hui2">玄幻</a>/<a href="http://all.qidian.com/book/bookstore.aspx?ChannelId=21&SubCategoryId=8" class="hui2">东方玄幻</a>]</div><div class="swb"><span class="swbt"><a href="/Book/24202.aspx" target="_blank">追寻古武术之路</a> </span><a href="/BookReader/24202,626650.aspx" target="_blank" class="hui2">第十七章 血莲</a> </div> <div class="swc">49338</div><div class="swd"><a href="http://me.qidian.com/authorIndex.aspx?id=15043" target="_blank" class="black">轮回的束缚</a></div> <div class="swe">05-03-22 15:31</div> </div><div class="sw2"><div class='swz'>552403</div><div class="swa">[<a href="http://all.qidian.com/book/bookstore.aspx?ChannelId=4" class="hui2">都市</a>/<a href="http://all.qidian.com/book/bookstore.aspx?ChannelId=4&SubCategoryId=12" class="hui2">都市生活</a>]</div><div class="swb"><span class="swbt"><a href="/Book/15695.aspx" target="_blank">好梦</a> </span><a href="/BookReader/15695,626579.aspx" target="_blank" class="hui2">第一章 秦陵之险</a> </div> <div class="swc">2943</div><div class="swd"><a href="http://me.qidian.com/authorIndex.aspx?id=9558" target="_blank" class="black">无情的忏悔</a></div> <div class="swe">05-03-17 09:25</div> </div>
是这样的一段HTML代码。下面这样看到的清楚一点。
<div class="sw2"> <div class='swz'>552401</div> <div class="swa">[<a href="http://all.qidian.com/book/bookstore.aspx?ChannelId=7" class="hui2">游戏</a>/<a href="http://all.qidian.com/book/bookstore.aspx?ChannelId=7&SubCategoryId=70" class="hui2">虚拟网游</a>]</div> <div class="swb"><span class="swbt"><a href="/Book/10027.aspx" target="_blank">网络贱圣</a> </span><a href="/BookReader/10027,626679.aspx" target="_blank" class="hui2">第一部 贱圣开始了 第十二章 小心!贱招</a> </div> <div class="swc">92835</div> <div class="swd"><a href="http://me.qidian.com/authorIndex.aspx?id=3091" target="_blank" class="black">地狱爱琴海</a></div> <div class="swe">05-03-17 11:07</div> </div> <div class="sw1"> <div class='swz'>552402</div> <div class="swa">[<a href="http://all.qidian.com/book/bookstore.aspx?ChannelId=21" class="hui2">玄幻</a>/<a href="http://all.qidian.com/book/bookstore.aspx?ChannelId=21&SubCategoryId=8" class="hui2">东方玄幻</a>]</div> <div class="swb"><span class="swbt"><a href="/Book/24202.aspx" target="_blank">追寻古武术之路</a> </span><a href="/BookReader/24202,626650.aspx" target="_blank" class="hui2">第十七章 血莲</a> </div> <div class="swc">49338</div> <div class="swd"><a href="http://me.qidian.com/authorIndex.aspx?id=15043" target="_blank" class="black">轮回的束缚</a></div> <div class="swe">05-03-22 15:31</div> </div> <div class="sw2"> <div class='swz'>552403</div> <div class="swa">[<a href="http://all.qidian.com/book/bookstore.aspx?ChannelId=4" class="hui2">都市</a>/<a href="http://all.qidian.com/book/bookstore.aspx?ChannelId=4&SubCategoryId=12" class="hui2">都市生活</a>]</div> <div class="swb"><span class="swbt"><a href="/Book/15695.aspx" target="_blank">好梦</a> </span><a href="/BookReader/15695,626579.aspx" target="_blank" class="hui2">第一章 秦陵之险</a> </div> <div class="swc">2943</div><div class="swd"><a href="http://me.qidian.com/authorIndex.aspx?id=9558" target="_blank" class="black">无情的忏悔</a></div> <div class="swe">05-03-17 09:25</div> </div>
希望抓出来的数据时这样的
sw sw1=new sw();
sw1.a=552401;
sw1.b=“[<a href="http://all.qidian.com/book/bookstore.aspx?ChannelId=7" class="hui2">游戏</a>/<a href="http://all.qidian.com/book/bookstore.aspx?ChannelId=7&SubCategoryId=70" class="hui2">虚拟网游</a>]”;
sw1.c=92835;
sw1.d="<a href="http://me.qidian.com/authorIndex.aspx?id=3091" target="_blank" class="black">地狱爱琴海</a>";
sw1.e="05-03-17 11:07";
sw sw2=new sw();
.......
<div\sclass="sw(?:1|2)">\s*<div class='swz'>(\d+)<\/div>\s*<div class="swa">(.*?)<\/div>\s*<div class="swb">(.*?)<\/div>\s*<div\sclass="swc">(\d+)<\/div>\s*<div\sclass="swd">(.*?)<\/div>\s*<div\sclass="swe">(.*?)<\/div>\s*<\/div>
自己去 6 个组里面取吧 !
大神哇!!
@跳舞: 好吧,,,,