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


代码如下:
‘=====================================
‘获取内容中所有图片
‘=====================================
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)<>”https://” 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

—-想了解更多的linux相关异常处理怎么解决关注<计算机技术网(www.ctvol.com)!!>



本文来自网络收集,不代表计算机技术网立场,如涉及侵权请联系管理员删除。

ctvol管理联系方式QQ:251552304

本文章地址:https://www.ctvol.com/htmltutorial/72141.html

(0)
上一篇 2020年4月14日
下一篇 2020年4月14日

精彩推荐