28,390
社区成员
发帖
与我相关
我的任务
分享
Content="<img height=11 src=http://a.gif width=10>adfas<img height=11 src=v.gif width=10>dfasf"
response.write savepic(Content)
response.end()
function savepic(str)
content=str&""
regstr="src\=.+?\.(gif|jpg)"
url=Replace(Replace(Replace(RegExp_Execute(regstr‚content)‚"'"‚"")‚""""‚"")‚"src="‚"")
savepic=url
end function
Function RegExp_Execute(patrn‚ strng)
Dim regEx‚ Match‚ Matches‚values '建立变量。
Set regEx = New RegExp '建立正则表达式。
regEx.Pattern = patrn '设置模式。
regEx.IgnoreCase = true '设置是否区分字符大小写。
regEx.Global = True '设置全局可用性。
Set Matches = regEx.Execute(strng) '执行搜索。
For Each Match in Matches '遍历匹配集合。
values=values&Match.Value&"‚"
Next
RegExp_Execute = values
End Function
Set objRegExp = New Regexp'设置配置对象
objRegExp.IgnoreCase = True'忽略大小写
objRegExp.Global = True'设置为全文搜索
objRegExp.Pattern = "<img.+?>"
strs=trim(str)
Set Matches =objRegExp.Execute(strs)'开始执行配置
For Each Match in Matches
RetStr = RetStr &getimgs( Match.value )'执行第二轮的匹配
Next
function getimgs(str)
getimgs=""
Set objRegExp1 = New Regexp
objRegExp1.IgnoreCase = True
objRegExp1.Global = True
objRegExp1.Pattern = "http://.+?";""'取出里面的地址
set mm=objRegExp1.Execute(str)
For Each Match1 in mm
getimgs=getimgs&"
"&left(Match1.value,len(Match1.value)-1)'把里面的地址串起来备用
next
end function
这是一个方式