用VBS写了一个- Const ForReading = 1
- Dim re,fso,f,strLine,strOut
-
- Set fso = CreateObject("Scripting.FileSystemObject")
- Set f = fso.OpenTextFile("1.txt", ForReading ,False) '文本保存在1.TXT
- Set re = New RegExp
-
- re.Pattern = ".*[\u4e00-\u9fa5]+.*"
-
- While Not f.AtEndOfLine
- strLine = f.ReadLine
- If re.Test(strLine) Then
- strOut = strOut & strLine & vbCrLf
- End If
- Wend
-
- Set f = fso.CreateTextFile("2.txt", True)
- f.Write strOut
-
- Msgbox "保存为2.txt"
-
- Set fso = Nothing
- Set f = Nothing
- Set re = Nothing
复制代码
|