asp中获取内容中所有图片与获取内容中第一个图片的代码

来源:asp之家 时间:2011-02-20 10:51:00 

代码如下:


'=====================================
'获取内容中所有图片
'=====================================
Function Get_ImgSrc(ByVal t0)
Dim t1,Regs,Matches,Match
t1=""
IF Not(IsNull(t0) Or Len(t0)=0) Then
Set Regs=New RegExp
Regs.Pattern="<img[^>]+src=""([^"">]+)""[^>]*>"
Regs.Ignorecase=True
Regs.Global=True
Set Matches=Regs.Execute(t0)
IF Matches.Count>0 Then
For Each Match In Matches
IF Left(Match.SubMatches(0),7)<>"http://" Then
t1=t1&"<option value="""&Match.SubMatches(0)&""">"&Match.SubMatches(0)&"</option>"
End IF
Next
End IF
End IF
Get_ImgSrc=t1
Set Matches=Nothing
Set Regs=Nothing
End Function

'=====================================
'获取内容中第一个图片
'=====================================
Function Frist_Pic(ByVal t0)
Frist_Pic=""
Dim Regs,Matches
Set Regs=New RegExp
Regs.Ignorecase=True
Regs.Global=True
Regs.Pattern="<img[^>]+src=""([^"">]+)""[^>]*>"
Set Matches=Regs.Execute(t0)
IF Regs.test(t0) Then
Frist_Pic=Matches(0).SubMatches(0)
End IF
Set Matches=Nothing
Set Regs=Nothing
End Function

标签:内容,图片
0
投稿

猜你喜欢

  • php实现上传图片保存到数据库的方法

    2024-05-09 14:48:35
  • Linux环境下MySQL-python安装过程分享

    2024-01-15 12:50:41
  • css清除浮动的方法总结与选择

    2008-06-06 12:58:00
  • python中urllib模块用法实例详解

    2022-02-05 13:23:33
  • Python字符串中删除特定字符的方法

    2023-07-25 18:58:54
  • python中if及if-else如何使用

    2022-12-06 08:14:15
  • 关于SQL嵌套的误解分析

    2024-01-22 22:01:03
  • 通过实例了解JS 连续赋值

    2024-05-02 16:15:14
  • python接口,继承,重载运算符详解

    2023-03-08 05:51:38
  • pytest框架之fixture详细使用详解

    2022-01-22 01:47:19
  • Django 自动生成api接口文档教程

    2022-09-11 06:40:26
  • 分享8 个常用pandas的 index设置

    2023-10-24 14:22:13
  • Vue不能检测到Object/Array更新的情况的解决

    2024-05-09 15:14:32
  • python区块链创建多个交易教程

    2021-05-28 13:40:42
  • Python实现FLV视频拼接功能

    2021-09-19 02:41:48
  • Node.js中Bootstrap-table的两种分页的实现方法

    2024-05-11 10:58:21
  • asp base64加解密函数代码

    2011-03-31 11:02:00
  • 基于Python实现Hash算法

    2023-09-21 17:29:58
  • cnpm不是内部命令的解决方案:配置环境变量【推荐】

    2023-03-11 13:27:47
  • ASP JSON类源码

    2011-04-30 16:38:00
  • asp之家 网络编程 m.aspxhome.com