VB6 正则表达式问题 - 提示无效的过程调用或者参数
PrivateSubCommand1_Click()DimsAsString'字符串DimpAsString'正则表达式DimrAsString'要替换的字符串s=Tex...
Private Sub Command1_Click()
Dim s As String '字符串
Dim p As String '正则表达式
Dim r As String '要替换的字符串
s = Text1.Text
p = "([0-9]{4}).([0-9]).([0-9]{2})"
Dim re1 As RegExp
Dim mhs1 As MatchCollection
Dim mh1 As Match
Set re1 = New RegExp
re1.IgnoreCase = True
re1.Global = True
re1.Pattern = p
Set mhs1 = re1.Execute(s)
Set mh1 = mhs1(0)
r = mh1.SubMatches(0) & ".0" & mh1.SubMatches(1) & "." & mh1.SubMatches(2)
Text2.Text = r
'下一遍
s = Text2.Text
p = "([0-9]{4}).([0-9]{2}).([0-9])"
Dim re2 As RegExp
Dim mhs2 As MatchCollection
Set re2 = New RegExp
re2.IgnoreCase = True
re2.Global = True
re2.Pattern = p
Set mhs2 = re2.Execute(s)
r = mh2.SubMatches(0) & "." & mh2.SubMatches(1) & ".0" & mh2.SubMatches(2)
Text2.Text = r
'下一遍
s = Text2.Text
p = "([0-9]{4}).([0-9]).([0-9])"
Dim re3 As RegExp
Dim mhs3 As MatchCollection
Set re3 = New RegExp
re3.IgnoreCase = True
re3.Global = True
re3.Pattern = p
Set mhs3 = re3.Execute(s)
r = mh3.SubMatches(0) & ".0" & mh3.SubMatches(1) & ".0" & mh3.SubMatches(2)
Text2.Text = r
End Sub
Set mh1 = mhs1(0) 一行:
实时错误5
无效的过程调用或者参数 展开
Dim s As String '字符串
Dim p As String '正则表达式
Dim r As String '要替换的字符串
s = Text1.Text
p = "([0-9]{4}).([0-9]).([0-9]{2})"
Dim re1 As RegExp
Dim mhs1 As MatchCollection
Dim mh1 As Match
Set re1 = New RegExp
re1.IgnoreCase = True
re1.Global = True
re1.Pattern = p
Set mhs1 = re1.Execute(s)
Set mh1 = mhs1(0)
r = mh1.SubMatches(0) & ".0" & mh1.SubMatches(1) & "." & mh1.SubMatches(2)
Text2.Text = r
'下一遍
s = Text2.Text
p = "([0-9]{4}).([0-9]{2}).([0-9])"
Dim re2 As RegExp
Dim mhs2 As MatchCollection
Set re2 = New RegExp
re2.IgnoreCase = True
re2.Global = True
re2.Pattern = p
Set mhs2 = re2.Execute(s)
r = mh2.SubMatches(0) & "." & mh2.SubMatches(1) & ".0" & mh2.SubMatches(2)
Text2.Text = r
'下一遍
s = Text2.Text
p = "([0-9]{4}).([0-9]).([0-9])"
Dim re3 As RegExp
Dim mhs3 As MatchCollection
Set re3 = New RegExp
re3.IgnoreCase = True
re3.Global = True
re3.Pattern = p
Set mhs3 = re3.Execute(s)
r = mh3.SubMatches(0) & ".0" & mh3.SubMatches(1) & ".0" & mh3.SubMatches(2)
Text2.Text = r
End Sub
Set mh1 = mhs1(0) 一行:
实时错误5
无效的过程调用或者参数 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询