日期:2014-05-18  浏览次数:20971 次

如何获取html中特定字符串中的值?
如下所示,该文本存储在txt中,现在需要获取该用户的收录数,如:<A title=收录他的名单64771个 href="http://t.qq.com/list_hison.php?u=liuxiang">中的"64771”,其他txt中“收录他”可能是“收录她”、“收录它”。
或者获取<STRONG class=listNum rel="liuxiang">64771</STRONG>标签中的数字“64771”也可以。

HTML:
<DIV class=w_head_outer>
<DIV class=headWrap>
<DIV id=header class=headInside>
<H1><A accessKey=z title=t.qq.com href="http://t.qq.com/sky_2011_sky" boss="btnClickNewLogo">腾讯微博</A> </H1>
<UL id=topNav class=topNav>
<LI class=topNavItem><A href="http://t.qq.com/sky_2011_sky"><U>首页</U><I></I></A> </LI>
<LI class=topNavItem><A href="http://t.qq.com/c/default"><U style="PADDING-RIGHT: 15px">广场</U><I></I></A><SUP class=ico_new_sr></SUP> </LI>
<LI class="topNavItem groups"><A href="http://qun.t.qq.com" boss="btnTopMenuGroup"><U>微群<EM>&nbsp;</EM></U><I></I></A> </LI>
<LI class=topNavItem><A href="http://t.qq.com/people"><U>找人</U><I></I></A> </LI>
<LI id=app class="topNavItem apps"><A href="http://app.t.qq.com" boss="btnTopMenuApp"><U>应用<EM>&nbsp;</EM></U><I></I></A> </LI>
<LI class=topNavItem><A href="http://p.t.qq.com/client.php?t=mobile"><U>手机</U><I></I></A> </LI></UL>
<UL class="topNav right">
<LI style="DISPLAY: none" class="topNavItem countItem topNavMsg"><A class="defaultCur txt" title=消息 href="#"><U><STRONG>0</STRONG></U><I></I></A> </LI>
<LI id=topNav1 class="topNavItem accountItem"><A class=txt title=杨显(@sky_2011_sky) onclick="if(document.body.className.indexOf('ipad') != -1){this.nextSibling.style.display='block';this.className+=' active';return false}" href="http://t.qq.com/sky_2011_sky?preview"><U>杨显<EM>&nbsp;</EM></U><I></I></A>
<UL style="DISPLAY: none" class=topNavSub>
<LI><A href="http://t.qq.com/setting" boss="btn_settingNewNav">设置</A> </LI>
<LI><A id=setTheme title=皮肤设置 onmousedown=window.scrollTo(0,0); href="#" boss="btn_themeNewNav">换肤</A> </LI>
<LI><A href="http://t.qq.com/help.php">帮助</A> </LI>
<LI><A href="http://t.qq.com/logout.php">退出</A> </LI></UL></LI></UL>
<DIV class=tSearchNew>
<FORM id=searchForm method=get action=http://t.qq.com/search/index.php><LABEL for=searchKey>搜他的广播/搜全站</LABEL><INPUT accessKey=s id=searchKey class=inputTxtNew maxLength=50 name=k autocomplete="off"> <INPUT value=174 type=hidden name=pos> <INPUT class=inputBtn value=搜索 type=submit> <A class=btn_ldrop href="#"><EM></EM></A></FORM></DIV>
<DIV id=nav_pub_wrap class=nav_pub_wrap><A class=btn_nav_pub title=写微博 href="#"><EM class=nav_pub_btn>写微博</EM><B class=nav_pub_bg1></B><B class=nav_pub_bg2></B> </A></DIV></DIV><A style="Z-INDEX: 101; POSITION: absolute; FONT-SIZE: 14px; TOP: 7px; RIGHT: 20px" id=testVersion class=testVersion href="http://1.t.qq.com" boss="btn_gotoNanoVersion">体验版<SPAN class=ico_new_sr><EM></EM><