本帖最后由 apang 于 2013-10-31 18:43 编辑
纯练习- Set fso = CreateObject("Scripting.FileSystemObject")
- text = fso.OpenTextFile("a.txt").Readall
-
- Set re = New RegExp
- re.Pattern = "([\s\S]*?\\pos\()(\d+),(\d+)\)|([\s\S]+)$"
- re.IgnoreCase = True
- re.Global = True
- For Each a In re.Execute(text)
- If a.SubMatches(3) = "" Then
- str = str & a.SubMatches(0) & _
- a.SubMatches(1) * 2 & "," & _
- a.SubMatches(2) * 2 & ")"
- Else str = str & a.SubMatches(3)
- End If
- Next
-
- fso.OpenTextFile("b.txt",2,True).Write str
复制代码
|