vbs 来一个- Dim fso, file, f, txt
- Set fso = CreateObject("Scripting.FileSystemObject")
- For Each file in fso.GetFolder("D:\数据").Files
- If LCase(Right(file, 4)) = ".txt" Then
- Set f = fso.OpenTextFile(file, 1)
- txt = f.ReadAll
- f.Close
- fso.OpenTextFile(file, 2, true).Write RegEx(txt)
- End If
- Next
-
- Function RegEx(ByVal txt)
- Dim re, e, n, i, j, k, s, m, m1, str
- Set re = New RegExp
- re.Pattern = "\d+"
- re.Global = True
- Set e = re.Execute(txt)
- n = e.Count - 1
- For i = 0 to n - 2
- For j = i + 1 to n - 1
- For k = j + 1 to n
- s = ""
- For m = 1 to 10
- m1 = m Mod 10
- If InStr(e(i) & e(j) & e(k), m1) Then s = s & m1
- Next
- If InStr(vbCrLf & str, vbCrLf & s & vbCrLf) = 0 Then
- str = str & s & vbCrLf
- End If
- Next
- Next
- Next
- RegEx = str
- End Function
复制代码
|