本帖最后由 pcl_test 于 2015-5-17 08:30 编辑
vbs- Dim fso,File1,File2,MyArr,regEx
- Set fso = CreateObject("Scripting.FileSystemObject")
- Set File1= fso.OpenTextFile(".\测试.txt", 1 , True)
- Set File2 = fso.CreateTextFile(".\结果.txt", 2 ,False)
- restr=InputBox("请输入分隔符(输入多个以空格相隔)")
- MyArr=Split(restr)
- For i=0 to ubound(MyArr)
- MyArr(i)="\"&MyArr(i)
- Next
- Set regEx=new regexp
- regEx.global=true
- regEx.ignorecase=true
- Do While File1.AtEndOfStream <> True
- str=File1.readLine
- For i=0 to ubound(MyArr)
- regEx.pattern=MyArr(i)
- str= regEx.Replace(str, vbCrLf)
- Next
- File2.WriteLine str
- Loop
- Set regEx=nothing
- File1.Close
- File2.Close
- MsgBox "完成!"
复制代码
|