<%
jeje = hello ("http://mmsg.qq.com/cgi-bin/gddylist?type=13&sort=1&page=3", "<html>", "</html>", ".*(<tdwidth =" " 35%"" bgcolor = ""#[/dabcde] {6} ""> (.*) </td>) [./ n]*"," <fontstyle = "" font-size: 9pt; "" color = azul> $ 2 </font> <br> "))
respuesta.writhehe
FunctionHello (Strurl, StrStart, Strend, Patrn, ReplStr)
Str = GetBody (Strurl)
Str = mymid (str, strstart, strend)
Str = reemplazo (Patrn, ReplStr, Str)
Hola = str
Función final
FunctionMymid (str, strstart, strend)
IfstrStart = "" entonces
i = 0
Demás
i = Instr (str, strstart)
Endif
Ifstrend = "" entonces
j = len (str)
Demás
J = Instr (i, str, strend)
Endif
Mymid = mid (str, i, j-i+1)
Función final
FunctionRePlaceTest (Patrn, ReplStr, Str1)
Dimregex, partido, partidos
Setregex = newregexp
regex.pattern = Patrn
regex.ignorecase = true
regex.global = verdadero
SetMatches = regex.execute (str1)
Foreachmatchinmatches
Reemplazar = reemplazarest®ex.replace (Match.Value, ReplStr)
Próximo
Función final
FunctionGetBody (URL)
Setobjxml = createObject ("Microsoft.xmlhttp")
Withobjxml
.Preen "Get", url, falso, "", ""
.Enviar
GetBody = .ResponseBody
Fin
GetBody = bytestobstr (GetBody, "GB2312")
Setobjxml = nada
Función final
FunctionByTestObstr (strbody, CodeBase)
Setobjstream = server.createObject ("ADODB.Stream")
Withobjstream
.Type = 1
.Mode = 3
.Abierto
.Writestbody
.Position = 0
.Type = 2
.Charset = CodeBase
Bytestobstr = .ReadText
.Cerca
Fin
Setobjstream = nada
Función final
%>
其他调用示例 :
jeje = hello ("http://list.mp3.baidu.com/song/a.htm", "<tableWidth =" "90%" "border =" "0" "align =" "centro" "celular =" "3" "" cellspacing = "0" "bgcolor =" "#f5f5f5" ">"> ">"> ">" "" , "<Divalign = Center>", ".*(<Tdwidth =" "20%" "> <ahref =" ".*/. Htm" "Target = _blank>) (.*) (</a> </td>) [./ n]*", "<fontstyle =" "font-tize: 9pT;" "color = azul> $ 2 <font> <font>