- Dim FSO, vbStr
- Set FSO = CreateObject("Scripting.FileSystemObject")
- vbStr = FSO.OpenTextFile("a.txt").ReadAll()
- Set FSO = Nothing
- MsgBox RegText(vbStr)
-
- Function RegText(RgStr)
- Dim REGEX
- Set REGEX = New RegExp
- REGEX.Global = True
- REGEX.IgnoreCase = True
- REGEX.Pattern = "[^1-9A-Z\s]*([1-9A-Z\s]*)[^1-9A-Z\s]*"
- RegText = REGEX.Replace(RgStr, "$1")
- Set REGEX = Nothing
- End Function
复制代码
|