ASP get all the pictures address of the content of the article body

Source: Internet
Author: User
Tags end split
Extracts the actual address of all pictures in a Web page or body content, and returns a list of pictures separated by |.

<%
Option Explicit
' Get all the picture addresses of the content of the article body
Function formatimg (content)
Dim Re,mm,match1,getimgs
Set re=new REGEXP
Re. IgnoreCase =true
Re. Global=true
Re. Pattern= "]*src (=) (. [ ^>]*) > "

Set Mm=re. Execute (content)
For each Match1 in mm
Getimgs=getimgs&imgurl (match1.value) & ""
' Getimgs=imgurl (Match1.value)
' Exit for
Next
Set re = Nothing
formatimg = Server. HTMLEncode (GETIMGS)
End Function

Function Imgurl (str)
Dim tmpstr
If InStr (str, "src=") >0 Then
TMPSTR = Split (str, "src=") (1)
If InStr (Tmpstr, "" "") >0 Then
TMPSTR = Split (Tmpstr, "" "") (1)
End If
If InStr (Tmpstr, "'") >0 Then
TMPSTR = Split (Tmpstr, "'") (1)
End If
Else
Tmpstr = ""
End If
Imgurl = Tmpstr
End Function

Response.Write formatimg ("<p> Arisisi Web Development Home </p><script src=" "Http://www.alixixi.com/ads/ads.asp" ></script><div><" Center><a target= "_blank" "href=" "I4.gif" "></a><br/> Arisisi Web Development Home <br/></center></div> ")
%>



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.