订阅本栏目 RSS您所在的位置: 深山工作室 > ASP > 正文

利用ASP正则提取文章里面的图片的有效的src地址

深山行者个人网站 2010/9/3 11:45:22 深山行者 字体: 浏览 12959

<%
Function gameimgs(content)
 Set regEx = New RegExp '建立正则表达式。
 regEx.Pattern = "(<img)(.[^<>]*)(src=)('|"&CHR(34)&"| )?(.[^'|\s|"&CHR(34)&"]*)(\.)(jpg|gif|png|bmp|jpeg)('|"&CHR(34)&"|\s|>)(.[^>]*)(>)" '设置模式。
 regEx.IgnoreCase = True '设置是否区分字符大小写。
 regEx.Global = True '设置全局可用性。
 Set Matches = regEx.Execute(content) '执行搜索。
 For Each Match in Matches '遍历匹配集合。
 '输入图片地址
 'Response.Write Match.SubMatches(4)&"."&Match.SubMatches(6)
 gameimgs = Match.SubMatches(4)&"."&Match.SubMatches(6)
 Next
End Function
%>

<ol>
<%
set imgrs=server.CreateObject("adodb.recordset")
imgrs.open "select * from news",conn,1,3
if imgrs.eof and imgrs.bof then
 response.write "111"
else
 do until imgrs.eof
  response.write "<li>"& imgrs("title")
  imgrs("saveimg") = gameimgs(imgrs("game"))
  imgrs("img") = gameimgs(imgrs("game"))

  response.write "</li>"
  imgrs.update
 imgrs.movenext
 loop
 
end if
imgrs.close
set imgrs=nothing
%>
</ol>
<%conn.close:set conn=nothing%>
利用ASP正则提取文章里面的图片的有效的src地址的示例

相关阅读
新敦煌国际旅行社
windows8的iis7应用程序池标识问题
地瓜坊美食
uni-app操作json数组
文本框输入限制
微软Encoder加密解密函数
启动旅行社管理系统3.0的开发服务
秀色摄影
更多信息>>栏目类别选择
百度小程序开发
微信小程序开发
微信公众号开发
uni-app
asp函数库
ASP
DIV+CSS
HTML
python
更多>>同类信息
ASP中Utf-8与Gb2312编码转换乱码问题的解决方法页面编码声明
asp显示随机密码
通过阿里云服务接口获得ip地址详细信息
iis点开后任务栏上有显示,但是窗口看不到的解决办法
RSA加密解密插件
微软Encoder加密解密函数
更多>>最新添加文章
dw里面查找替换使用正则删除sqlserver里面的CONSTRAINT
Android移动端自动化测试:使用UIAutomatorViewer与Selenium定位元素
抖音直播音挂载小雪花 懂车帝小程序
javascript获取浏览器指纹可以用来做投票
火狐Mozilla Firefox出现:无法载入您的Firefox配置文件 它可能已经丢失 或是无法访问 问题解决集合处理办法
在Android、iOS、Windows、MacOS中微信小程序的文件存放路径
python通过代码修改pip下载源让下载库飞起
python里面requests.post返回的res.text还有其它的吗
更多>>随机抽取信息
走四方旅行社
一个可以选择变化背景色的小程序
留言动态显示图片
深山留言板V2.1 Build 090620
解决国内 github.com 打不开的准确方法
ASP.NET常用的三十三种实用代码(上)