本帖最后由 ss1268 于 2012-2-7 11:56 编辑
回复 2# Demon
谢谢老师的解答,基本是这种效果。
还有一个疑问,请问如何在头尾都把%带上,谢谢!
同时一下脚本出错,不知哪里有问题,还亲老师帮忙看看,- ' -- Start Script
- Call Main()
- '////////////////////
- ' Sub Declaration
- ' ////////////////////
- Sub Main()
- Dim fso
-
- Set fso = CreateObject("Scripting.FileSystemObject")
- Str = fso.OpenTextFile("data.text").ReadAll
-
- ShowString(RegExpTest("%([^%]+)%", Str))
-
- Set fso = Nothing
- End Sub
-
- Function RegExpTest(patrn, Str)
- Dim regEx, Match, Matches, RetStr, i ' Create variable.
- Set regEx = New RegExp
- regEx.Pattern = patrn
- regEx.IgnoreCase = True
- regEx.Global = True
- Set Matches = regEx.Execute(Str)
- For i = 0 To Matches.Count - 1
- fso.OpenTextFile(i & ".nc", 2, True).Write Matches.Item(i).Submatches(0)
- Next
- RegExpTest = RetStr
- End Function
复制代码
|