7,763
社区成员
发帖
与我相关
我的任务
分享
引用Microsoft VBScript Regular Expressions 5.5.
'两文本框设为多行显示
'将你的文本粘贴到Text1
Private Sub Command1_Click()
Dim re As RegExp
Dim mh As Match
Dim mhs As MatchCollection
Dim inpStr As String
inpStr = Text1.Text
Set re = New RegExp
re.Pattern = "\d{9}|\d{6}"
re.IgnoreCase = True
re.Global = 2
Set mhs = re.Execute(inpStr)
For Each Match In mhs
S = S & Match.Value & vbCrLf
Next
Text2.Text = S
End Sub
set fso = createobject("scripting.filesystemobject")
set stream = fso.opentextfile("input.txt",1)
content = stream.readall
call stream.close
set reg = new regexp
reg.global = true
reg.pattern = "uin=(\d+)"
set matches = reg.execute(content)
for each match in matches
result = result & match.submatches(0) & vbcrlf
next
set stream = fso.opentextfile("output.txt",2,true)
call stream.write(result)
call stream.close