There are still bugs, the latest test page in: http://www.reallydo.com/getimg.asp
Regular analysis page in: http://jorkin.reallydo.com/article.asp? Id = 380
Please leave a message after discovering the BUG. Thank you.
1.31 Amendment
Src = the following space cannot match correctly. corrected.
An error occurred when src = ''is null. corrected.
Detected BUG: Only one space can be retained when the image path has multiple spaces. It is not corrected.
2.18 Amendment
Only one BUG can be retained when there are multiple spaces in the image path. Fixed.
<%
'Function: Get all image addresses and save them to an array.
'Source: http://jorkin.reallydo.com/article.asp? Id = 448
'Need ReplaceAll function: http://jorkin.reallydo.com/article.asp? Id = 406
Function getIMG (sString)
Dim sReallyDo, regEx, iReallyDo
Dim oMatches, cMatch
'// Defines an empty array
IReallyDo =-1
ReDim aReallyDo (iReallyDo)
If IsNull (sString) Then
GetIMG = ""
Exit Function
End If
'// Format the HTML code
'// Wrap each SReallyDo = sString
On Error Resume Next
SReallyDo = Replace (sReallyDo, vbCr ,"")
SReallyDo = Replace (sReallyDo, vbLf ,"")
SReallyDo = Replace (sReallyDo, vbTab ,"")
SReallyDo = Replace (sReallyDo, "SReallyDo = Replace (sReallyDo, "/>", "/>", 1,-1, 1)
SReallyDo = ReplaceAll (sReallyDo, "=", "=", True)
Sreallydo = replaceall (sreallydo, ">", ">", true)
Sreallydo = Replace (sreallydo, "> <", ">" & vbcrlf & "<")
Sreallydo = trim (sreallydo)
On Error goto 0
Set RegEx = new Regexp
RegEx. ignorecase = true
RegEx. Global = true
'// Remove the onclick, onload, and other scripts
RegEx. pattern = "\ s [on]. +? = ([\ "" | \ ']) (. *?) \ 1"
Sreallydo = RegEx. Replace (sreallydo ,"")
'// Enclose the image address of SRC without quotation marks with quotation marks
RegEx. pattern = "] *). *?> "
Sreallydo = RegEx. Replace (sreallydo, " ")
'// The SRC address of the matching image
RegEx. pattern = " "
Set omatches = RegEx. Execute (sreallydo)
'// Save the image address to an array
For each cmatch in omatches
Ireallydo = ireallydo + 1
Redim preserve areallydo (ireallydo)
Areallydo (ireallydo) = RegEx. Replace (cmatch. value, "$2 ")
Next
Getimg = areallydo
End Function
%>
Source: http://Jorkin.Reallydo.Com/default.asp? Id = 448