- Function GetIP(path)
- Dim fso, re, str, ms, i, a()
- Set fso = CreateObject("Scripting.FileSystemObject")
- Set re = New RegExp
-
- re.Global = True
- re.Pattern = "((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[09][0-9]|[1-9][0-9]|[0-9])"
-
- str = fso.OpenTextFile(path).ReadAll
-
- Set ms = re.Execute(str)
- ReDim a(ms.Count - 1)
-
- For i = 0 To ms.Count - 1
- a(i) = ms.Item(i)
- Next
-
- GetIP = a
- End Function
复制代码
|