classic ASP regex to get all pages from local domain

protlaporhan

New Member
Hello i need a regex expression to get all the links from a localdomain no external websites.Till now i have this but returning only outside pages\[code\]<%function getPage(strURL)dim strBody, objXMLset objXML = CreateObject("Msxml2.ServerXMLHTTP.6.0") objXML.Open "GET", strURL, False 'objXML.setRequestHeader "User-Agent", "ddd" '=== falsify the agent 'objXML.setRequestHeader "Content-Type", "text/html; Charset:ISO-8859-1" 'objXML.setRequestHeader "Content-Type", "text/html; Charset:UTF-8" objXML.Send status = objXML.status if err.number <> 0 or status <> 200 then if status = 404 then Response.Write "[EFERROR]Page does not exist (404)." elseif status >= 401 and status < 402 then Response.Write "[EFERROR]Access denied (401)." elseif status >= 500 and status <= 600 then Response.Write "[EFERROR]500 Internal Server Error on remote site." else Response.write "[EFERROR]Server is down or does not exist." end if end if strBody = objXML.responseTextset objXML = nothinggetPage = strBody'First, create a reg exp objectDim objRegExpSet objRegExp = New RegExpobjRegExp.IgnoreCase = TrueobjRegExp.Global = TrueobjRegExp.Pattern = "<a\s+href=""http://(.*?)"">\s*((\n|.)+?)\s*</a>"'Display all of the matchesDim objMatchFor Each objMatch in objRegExp.Execute(strBody) Response.Write("http://" & objMatch.SubMatches(0) & "<br>")Nextend functiongetPage("http://www.google.com")%>\[/code\]thank you
 
Back
Top