Dim a, b, c, fso, re, strB
Set ws = CreateObject("Wscript.Shell")
Set fso = CreateObject("scripting.filesystemobject")
Set re = CreateObject("vbscript.REGEXP")
sPath = WScript.ScriptFullName
sCurDir = FSO.GetParentFolderName(sPath)
For Each f In fso.GetFolder(sCurDir).Files
If InStr(f.Name, ".txt") > 0 Then
Debug.Write(f)
strA = fso.OpenTextFile(f.Name, 1).ReadAll()
re.Pattern = "p[\s\S]{1,}(?=65)"
re.IgnoreCase = 1
If re.Test(strA) Then
Set ma = re.Execute(strA)
For Each m In ma
strB=strB+vbcrlf+m
Next
End If
End If
Next
fso.OpenTextFile(sCurDir & "\结果.txt",2,1).Write(strB)
Set fso=Nothing
MsgBox "ok,已完成!"
VBS提取文中中指定两个字符间的内容
最新推荐文章于 2022-03-10 16:19:46 发布