VBS的有正则,条理清晰多了- option explicit
- dim fso, class1, class2, exp, a
- set fso = createobject("scripting.filesystemobject")
- set class1 = fso.opentextfile("123.txt")
- write(func1(class1.readall))
- class1.close
-
- function func1(str)
- set exp = new regexp
- exp.pattern = "[[][0-9]*[]]"
- exp.global = true
- func1 = exp.replace(str, "")
- end function
-
- function write(str)
- set class2 = fso.opentextfile("123.txt", 2)
- class2.write str
- class2.close
- end function
复制代码
|