回 帖 发 新 帖 刷新版面

主题:vb 提取文本中 指定的URL

文本内容如下:
<LI><A title=查看3 style="BACKGROUND-IMAGE: url(http://hd44.xiaonei.com/photos/hd44/20080704/22/45/tiny_6046c169.jpg)" href="http://xiaonei.com/getuser.do?portal=homeFootprint&amp;id=223997507"></A><SPAN class="olname clearfix"><IMG title="3 在线" src="http://xnimg.cn/imgpro/icons/online.gif"><A href="http://xiaonei.com/getuser.do?portal=homeFootprint&amp;id=223997507">3</A></SPAN><SPAN class=small>昨天</SPAN> </LI>
<LI><A title=查看2 style="BACKGROUND-IMAGE: url(http://hd36.xiaonei.com/photos/hd36/20080923/19/04/tiny_zOWC_6918e200150.jpg)" href="http://xiaonei.com/getuser.do?portal=homeFootprint&amp;id=239335810"></A><SPAN class="olname clearfix"><IMG title="2 在线" src="http://xnimg.cn/imgpro/icons/online.gif"><A href="http://xiaonei.com/getuser.do?portal=homeFootprint&amp;id=239335810">2</A></SPAN><SPAN class=small>昨天</SPAN> </LI>
<LI><A title=查看1 style="BACKGROUND-IMAGE: url(http://hd52.xiaonei.com/photos/hd52/20080609/16/55/tiny_4959d169.jpg)" href="http://xiaonei.com/getuser.do?portal=homeFootprint&amp;id=221156796"></A><SPAN class="olname clearfix"><IMG title="1 在线" src="http://xnimg.cn/imgpro/icons/online.gif"><A href="http://xiaonei.com/getuser.do?portal=homeFootprint&amp;id=221156796">1</A></SPAN><SPAN class=small>10月15日</SPAN> </LI>


我想从 以上文本中获取 如:http://xiaonei.com/getuser.do? 样式的链接并输出 怎么做?
我的代码如下:
Open 文本路径 For Input As #1
Do While Not EOF(1)
Line Input #1, a
If Left$(a, 30) = "http://xiaonei.com/getuser.do?" Then
  If wenben = "" Then
   wenben = a
  Else
   wenben = wenben + vbNewLine + a
  End If
 End If

可是为什么得不到呢?

回复列表 (共1个回复)

沙发

我觉得这种问题还是用正则表达式解决来得容易

一个一个自己分析,真的难为你了

我来回复

您尚未登录,请登录后再回复。点此登录或注册