正则表达式提取结果转数组问题
Public Function GetTextByS(ByVal sstr As String) As String()
Dim mc As MatchCollection
Dim r As Regex = New Regex("msgcode=.*?\&account")
mc = r.Matches(sstr)
Dim s As String()
For i As Integer = 0 To mc.Count - 1
//以下问题语句
s(i) = mc(i).Value
//以上问题语句
Next
Return s
End Function
以上始终报告未将对象引用设置到对象的实例,请问改怎么改?
我的目的是将用正则表达式提取的n个字符川放在s数组里传回。
以上代码正则表达式提取是正确的,如果s不定义为数组,正常返回值。