有一些网页的源文件,想从中获取指定的内容如下
/ieie/rusult-FFD8E2EA1734FA3D81EA7AADE81254E6.html
/ieie/rusult-31EF37AC551E82EA4AA4C3BDB1E4F46C.html
/ieie/rusult-52A7132097148705774A7C68854AE2EE.html
……
(每个网页有十几个这样的链接,每个链接rusult后面的值是不同的。想把它们一行一个写入TXT文件中)
该如何用VB6编程实现呢?涉及到正则问题。这个正则又如何写呢?
/div><div class="goodgood"><a href="/ieie/rusult-FFD8E2EA1734FA3D81EA7AADE81254E6.html" target="_blank"><img width="80" height="120" src="http://abcd1.helloyo.com/abcd/Abcd.dll?uoy=656563676B6B636866683235383833373134" class="pic l" /></a><dl class="intro l"><dt><a name="qeiege" href="/ieie/rusult-e97d2604df72394875b29144ba4930e1.html" target="_blank">天时天晴厨师理晨</a></dt><dd>语文:<a name="dognty" style="color:#000;text-decoration:none">别是里弄</a></dd><dd>数学:睚城</dd><dd>体育:太师椅2金05地</dd><dd style="border-bottom: 1px dotted #b4b4b4; margin: 6px 0"></dd><dd style="color: #666"><div class="l" style="line-height: 1.2">
【天下之大】<span style="font-size: 14px">#7.0</span> </div><div class="r" style="width: 256px; padding-top: 12px"><form action="/order/myorder.jhtml" method="get" id="form_70641" target="_blank"><input type="hidden" name="cmd" value="submit"/><input type="hidden" name="ids" value="70641"/><input type="hidden" name="foddes" value="1"/><a href="#" onclick="L.getDom('form_70641').submit();"><img src="/images/btn_buy2.gif" /></a> <a href="#" onclick="Cart.add('e97d2604df72394875b29144ba4930e1')"><img src="/images/btn_bus2.gif" /></a> <a href="#" onclick="Finfo.feioygo('e97d2604df72394875b29144ba4930e1')"><img src="/images/feioygo.jpg" /></a></form></div></dd></dl><div style="clear: both"></div></div><div class="hr"></div><div class="goodgood"><a href="/ieie/rusult-31EF37AC551E82EA4AA4C3BDB1E4F46C.html" target="_blank"><img width="80" height="120" src="http://abcd1.helloyo.com/abcd/Abcd.dll?uoy=656563676C6A63686B663235383833373134" class="pic l" /></a><dl class="intro l"><dt><a name="qeiege" href="/ieie/rusult-31EF37AC551E82EA4AA4C3BDB1E4F46C.html" target="_blank">进百</a></dt><dd>语文:<a name="dognty" style="color:#000;text-decoration:none">(悲)杜鹃田地</a></dd><dd>数学:是不是百</dd><dd>体育:时百8金08地</dd><dd style="border-bottom: 1px dotted #b4b4b4; margin: 6px 0"></dd><dd style="color: #666"><div class="l" style="line-height: 1.2">
【天下之大】<span style="font-size: 14px">#7.0</span> </div><div class="r" style="width: 256px; padding-top: 12px"><form action="/order/myorder.jhtml" method="get" id="form_79936" target="_blank"><input type="hidden" name="cmd" value="submit"/><input type="hidden" name="ids" value="79936"/><input type="hidden" name="foddes" value="1"/><a href="#" onclick="L.getDom('form_79936').submit();"><img src="/images/btn_buy2.gif" /></a> <a href="#" onclick="Cart.add('31EF37AC551E82EA4AA4C3BDB1E4F46C')"><img src="/images/btn_bus2.gif" /></a> <a href="#" onclick="Finfo.feioygo('31EF37AC551E82EA4AA4C3BDB1E4F46C')"><img src="/images/feioygo.jpg" /></a></form></div></dd></dl><div style="clear: both"></div></div><div class="hr"></div><div class="goodgood"><a href="/ieie/rusult-52A7132097148705774A7C68854AE2EE.html" target="_blank"><img width="80" height="120" src="http://abcd1.helloyo.com/abcd/Abcd.dll?uoy=656563676B6B63686A6A3235383833373134" class="pic l" /></a><dl class="intro l"><dt><a name="qeiege" href="/ieie/rusult-52A7132097148705774A7C68854AE2EE.html" target="_blank">优胜劣汰进在</a></dt><dd>语文:<a name="dognty" style="color:#000;text-decoration:none">渔郎</a></dd><dd>数学:实馆</dd><dd>体育:朋有18金06地</dd><dd style="border-bottom: 1px dotted #b4b4b4; margin: 6px 0"></dd><dd style="color: #666"><div class="l" style="line-height: 1.2">
/ieie/rusult-FFD8E2EA1734FA3D81EA7AADE81254E6.html
/ieie/rusult-31EF37AC551E82EA4AA4C3BDB1E4F46C.html
/ieie/rusult-52A7132097148705774A7C68854AE2EE.html
……
(每个网页有十几个这样的链接,每个链接rusult后面的值是不同的。想把它们一行一个写入TXT文件中)
该如何用VB6编程实现呢?涉及到正则问题。这个正则又如何写呢?
/div><div class="goodgood"><a href="/ieie/rusult-FFD8E2EA1734FA3D81EA7AADE81254E6.html" target="_blank"><img width="80" height="120" src="http://abcd1.helloyo.com/abcd/Abcd.dll?uoy=656563676B6B636866683235383833373134" class="pic l" /></a><dl class="intro l"><dt><a name="qeiege" href="/ieie/rusult-e97d2604df72394875b29144ba4930e1.html" target="_blank">天时天晴厨师理晨</a></dt><dd>语文:<a name="dognty" style="color:#000;text-decoration:none">别是里弄</a></dd><dd>数学:睚城</dd><dd>体育:太师椅2金05地</dd><dd style="border-bottom: 1px dotted #b4b4b4; margin: 6px 0"></dd><dd style="color: #666"><div class="l" style="line-height: 1.2">
【天下之大】<span style="font-size: 14px">#7.0</span> </div><div class="r" style="width: 256px; padding-top: 12px"><form action="/order/myorder.jhtml" method="get" id="form_70641" target="_blank"><input type="hidden" name="cmd" value="submit"/><input type="hidden" name="ids" value="70641"/><input type="hidden" name="foddes" value="1"/><a href="#" onclick="L.getDom('form_70641').submit();"><img src="/images/btn_buy2.gif" /></a> <a href="#" onclick="Cart.add('e97d2604df72394875b29144ba4930e1')"><img src="/images/btn_bus2.gif" /></a> <a href="#" onclick="Finfo.feioygo('e97d2604df72394875b29144ba4930e1')"><img src="/images/feioygo.jpg" /></a></form></div></dd></dl><div style="clear: both"></div></div><div class="hr"></div><div class="goodgood"><a href="/ieie/rusult-31EF37AC551E82EA4AA4C3BDB1E4F46C.html" target="_blank"><img width="80" height="120" src="http://abcd1.helloyo.com/abcd/Abcd.dll?uoy=656563676C6A63686B663235383833373134" class="pic l" /></a><dl class="intro l"><dt><a name="qeiege" href="/ieie/rusult-31EF37AC551E82EA4AA4C3BDB1E4F46C.html" target="_blank">进百</a></dt><dd>语文:<a name="dognty" style="color:#000;text-decoration:none">(悲)杜鹃田地</a></dd><dd>数学:是不是百</dd><dd>体育:时百8金08地</dd><dd style="border-bottom: 1px dotted #b4b4b4; margin: 6px 0"></dd><dd style="color: #666"><div class="l" style="line-height: 1.2">
【天下之大】<span style="font-size: 14px">#7.0</span> </div><div class="r" style="width: 256px; padding-top: 12px"><form action="/order/myorder.jhtml" method="get" id="form_79936" target="_blank"><input type="hidden" name="cmd" value="submit"/><input type="hidden" name="ids" value="79936"/><input type="hidden" name="foddes" value="1"/><a href="#" onclick="L.getDom('form_79936').submit();"><img src="/images/btn_buy2.gif" /></a> <a href="#" onclick="Cart.add('31EF37AC551E82EA4AA4C3BDB1E4F46C')"><img src="/images/btn_bus2.gif" /></a> <a href="#" onclick="Finfo.feioygo('31EF37AC551E82EA4AA4C3BDB1E4F46C')"><img src="/images/feioygo.jpg" /></a></form></div></dd></dl><div style="clear: both"></div></div><div class="hr"></div><div class="goodgood"><a href="/ieie/rusult-52A7132097148705774A7C68854AE2EE.html" target="_blank"><img width="80" height="120" src="http://abcd1.helloyo.com/abcd/Abcd.dll?uoy=656563676B6B63686A6A3235383833373134" class="pic l" /></a><dl class="intro l"><dt><a name="qeiege" href="/ieie/rusult-52A7132097148705774A7C68854AE2EE.html" target="_blank">优胜劣汰进在</a></dt><dd>语文:<a name="dognty" style="color:#000;text-decoration:none">渔郎</a></dd><dd>数学:实馆</dd><dd>体育:朋有18金06地</dd><dd style="border-bottom: 1px dotted #b4b4b4; margin: 6px 0"></dd><dd style="color: #666"><div class="l" style="line-height: 1.2">
解决方案 »
- 在ie中一切正常,在webbrowser便出现脚本错误!
- 不同窗体能使用同一个mscomm吗?
- 100分,正解马上揭贴给分。在一个应用程序中,如何制作开机后自动启动程序,以及取消自动运行(不需要任务栏图标)?
- 如何根据一个数据集得到另一数据集
- 新年到来,你用什么祝福你的朋友,我用<送福信使> V1.0
- VB居然建过时的ACCESS95数据库!!!
- 我连接到sybase12的数据库,为什么select之后,游标好像是定在了最后一条,为什么?
- 使用ADO创建 Northwind 的OLE DB 数据链接问题之在哪里?
- 怎么用VB WINSOCK 发送数据结构
- 在Win2000下,控制面板中为什么没有输入法设置,在Win98有输入法设置,现在我要在Win2000下用到五笔字型输入法,我该怎么办?
- VB能生成WMF吗?
- 数据库的记录无法正常移动的问题?
Dim strData$
Dim reg As Object
Dim matchs As Object, match As Object
strData = "/div> <div class=""goodgood""> <a href=""/ieie/rusult-FFD8E2EA1734FA3D81EA7AADE81254E6.html"" target=""_blank"">"
Set reg = CreateObject("vbscript.regexp")
reg.Global = True
reg.IgnoreCase = True
reg.Pattern = "/ieie/rusult-.*\.html"
Set matchs = reg.Execute(strData)
For Each match In matchs
Debug.Print match.Value
Next
End Sub
/ieie/rusult-.*?\.html
dim name,line as string Open "C:\文件.txt" For Append As #1 '保存到C:\文件.txt
For i = 0 To WebBrowser1.Document.links.length - 1
name=WebBrowser1.Document.links(i).innerText
line=WebBrowser1.Document.links(i).href
if instr(1,name,"ieie/rusult")>0 then '过滤连接
Print #1, line
end if
Next
Close #1