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

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

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

<%
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地址的示例

相关阅读
IE8 CSS HACK 兼容
深山行者留言系统V3.1
Appium元素定位方式之android_uiautomator定位
IE 7.0 BETA3 浏览器绿色免安装版下载
asp计算器
深山行者留言系统V2.2 (简称留言板V2.2)
Appium获取手机分辨率 & 自适应设备下滑刷新
字体放大效果,字体[大][中][小]
更多信息>>栏目类别选择
百度小程序开发
微信小程序开发
微信公众号开发
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还有其它的吗
更多>>随机抽取信息
window.location.href跳转无反应不跳转解决
吉林省观光国际旅行社
纯div+css制作的弹出菜单-02
CSS光标属性一览表
asp无限级调用分类显示
九江市交通国际旅行社有限公司