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


猜你喜欢
php实现上传图片保存到数据库的方法

Linux环境下MySQL-python安装过程分享
css清除浮动的方法总结与选择
python中urllib模块用法实例详解
Python字符串中删除特定字符的方法

python中if及if-else如何使用
关于SQL嵌套的误解分析

通过实例了解JS 连续赋值

python接口,继承,重载运算符详解

pytest框架之fixture详细使用详解

Django 自动生成api接口文档教程

分享8 个常用pandas的 index设置

Vue不能检测到Object/Array更新的情况的解决

python区块链创建多个交易教程
Python实现FLV视频拼接功能
Node.js中Bootstrap-table的两种分页的实现方法
asp base64加解密函数代码
基于Python实现Hash算法

cnpm不是内部命令的解决方案:配置环境变量【推荐】
