提取一段内容中的所有图片或者图片地址:https://blog.csdn.net/vince6799/article/details/6765283
<%Function RegImg(TheStr)
Dim RegEx
Set RegEx = New RegExp
RegEx.IgnoreCase =True
RegEx.Global = True
RegEx.Pattern = "<img[^>]*src\s*=\s*['"&CHR(34)&"]?([\w/\-\:.]*)['"&CHR(34)&"]?[^>]*>"
If Regex.test(TheStr) then
Dim Matches
Set Matches = RegEx.Execute(TheStr) ' 执行搜索。
For Each Match in Matches ' 遍历匹配集合。
RetStr = RetStr & Match.Value & "<br />" '获取整个img
RetStr = RetStr & Match.SubMatches(0) '只取src
Next
RegImg = RetStr
End If
End Function%>
ASP获取文章中所有图片中第一张或第一张图片地址:https://blog.csdn.net/yang3rui/article/details/102251261
<%
'获取内容中第一张图片地址函数
'author:xycms
'update:20191006
Function g_fpic(ByVal t0)
f_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
f_pic=Matches(0).SubMatches(0)
End IF
Set Matches=Nothing
Set Regs=Nothing
End Function
%>