这里是源文件
http://upload.cn-dos.net/img/1682.txt
我想用vbs提取最近一条留言的用户名,标题,留言时间,留言IP。
但我只能提取用户名的内容,其它的不知道如何提取,请各位大侠帮忙。
源文件里前面的三条留言是公告,以后可能会继续添加公告,所以提取的内容要跳过它。
以下是我写的提取用户名的vbs.
http://upload.cn-dos.net/img/1682.txt
我想用vbs提取最近一条留言的用户名,标题,留言时间,留言IP。
但我只能提取用户名的内容,其它的不知道如何提取,请各位大侠帮忙。
源文件里前面的三条留言是公告,以后可能会继续添加公告,所以提取的内容要跳过它。
以下是我写的提取用户名的vbs.
wscript.echo "用户名是:" & RegExpTest("<li class=""userName"">(*)</li>",ReadText("sourcefile.txt"))
Function RegExpTest(Patrn,strng)
Set RegEx1=New RegExp
RegEx1.Pattern = Patrn
RegEx1.IgnoreCase=True
RegEx1.Global=Fasle
Set Matches =RegEx1.Execute(strng)
For Each Match In Matches
i=i+1
RetStr=RetStr & Match.SubMatches(0)
If i Mod 2 = 0 Then
RetStr=RetStr & vbCrLf
End If
Next
RegExpTest=RetStr
End Function
Function ReadText(FilePath)
Dim Fso,Rso
Set Fso=CreateObject("Scripting.FileSystemObject")
Set Gso=Fso.GetFile(FilePath)
Set Rso=Gso.OpenAsTextStream(1)
ReadText=Rso.ReadAll
End Function
