Function RegExpTest(patrn, strng)
Dim regEx, Match, Matches '建立变量。
Set regEx = New RegExp '建立正则表达式。
regEx.Pattern = patrn'设置模式。
regEx.IgnoreCase = True '设置是否区分字符大小写。
regEx.Global = True '设置全局可用性。
Set Matches = regEx.Execute(strng)'执行搜索。
For Each Match in Matches'遍历匹配集合。
RetStr = RetStr & "|" & Match.SubMatches(0)
Next
RegExpTest = RetStr
End Function
Function getHTTPPage(Path)
t = GetBody(Path)
getHTTPPage = BytesToBstr(t, "GB2312")
End Function
Function GetBody(url)
On Error Resume Next
Set xmlhttp = CreateObject("Microsoft.XMLHTTP")
With xmlhttp
.Open "Get", url, False, "", ""
.Send
If xmlhttp.Status<>200 Then Exit Function
GetBody = .ResponseBody
End With
Set xmlhttp = Nothing
End Function
Function BytesToBstr(Body, Cset)
On Error Resume Next
Dim objstream
Set objstream = CreateObject("adodb.stream")
objstream.Type = 1
objstream.Mode = 3
objstream.Open
objstream.Write Body
objstream.Position = 0
objstream.Type = 2
objstream.Charset = Cset
BytesToBstr = objstream.ReadText
objstream.Close
Set objstream = Nothing
End Function
Function CreateFile(FileName, Content)
Set FSO = CreateObject("Scripting.FileSystemObject")
Set fd = FSO.CreateTextFile(FileName, True)
fd.WriteLine Content
End Function