- Dim str, fso, file, f, bat
- Set fso = CreateObject("Scripting.FileSystemObject")
- For Each file in fso.GetFolder(".").Files
- If LCase(Right(file, 4)) = ".bat" Then
- Set f = fso.OpenTextFile(file, 1)
- bat = f.ReadAll
- f.Close : Set f = Nothing
- fso.OpenTextFile(file, 2).Write RegEx(bat)
- End If
- Next
- Set fso = Nothing
-
- MsgBox "OK"
-
- Function RegEx(bat)
- Set re = New RegExp
- re.Pattern = "\\注汇总([0-9]+)\\"""
- re.Global = True
- re.IgnoreCase = True
- RegEx = re.Replace(bat, "\随机值$1\""")
- End Function
复制代码 正则表达式那里匹配\用\\,匹配"用"",替换值那里\只用一个\表示 |