本帖最后由 batman 于 2012-12-28 22:31 编辑
用vbs正则:- Dim FSO, redStr, Arr, vbStr
- Set FSO = CreateObject("Scripting.FileSystemObject")
- redStr = FSO.OpenTextFile("test.html").ReadAll
- Arr = Split(GetText(redStr), "分钟")
- For Each str In Arr
- str = Replace(str, vbCrLf, "")
- For Each var In Split(str, " ")
- If Replace(var, " ", "") <> "" Then
- If Mid(var,3,1) & Mid(var,6,1) = "::" Then var = Mid(var,1,8) & vbTab & Mid(var,9,Len(var))
- vbStr = vbStr & var & vbTab
- End If
- Next
- vbStr = Left(vbStr, Len(vbStr)-1) & "分钟" & vbCrLf
- Next
- FSO.OpenTextFile("new.txt", 2, True).Write Left(vbStr, Len(vbStr)-4)
- Set FSO = Nothing
- CreateObject("Wscript.Shell").Run "cmd /cstart new.txt", True, False
-
- Function GetText(String)
- Dim objExp
- Set objExp = New RegExp
- objExp.Global = True
- objExp.IgnoreCase = True
- objExp.Pattern = "<td>([^<>]+)<\/td>|\s|\S"
- objExp.Execute(String)
- GetText = objExp.Replace(String, "$1")
- End Function
复制代码
|