vb.net提取html网址,如何提取网页代码中指定内容

怎么提取网页代码中指定内容?

某数据库网页结构如下:

html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

2015年9月6日 17:18

农业药械: 

瞬时流量:175.30 m3/h 

累计流量:79438 m3 

程序下载到html文件中,名称为1400.html,源代码如上,现在想提取              

农业药械: 

  这一句,怎么编程?

------解决思路----------------------

Imports System.Text.RegularExpressions

Imports System.Text

Public Class Form1

Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load

Dim strWeb As String = IO.File.ReadAllText(Application.StartupPath & "\1400.html", Encoding.Default)

MsgBox(strWeb)

Dim re As Regex

re = New Regex("

(.*?)

", RegexOptions.IgnoreCase)

If re.IsMatch(strWeb) Then

MsgBox(re.Match(strWeb).Groups(1).Value)

End If

re = New Regex("

(.*?)

", RegexOptions.IgnoreCase)

If re.IsMatch(strWeb) Then

For Each mat As Match In re.Matches(strWeb)

MsgBox(mat.Groups(1).Value)

Next

End If

End Sub

End Class

拿去不谢,百度“正则表达式”

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值