在vb.net中沒有C#“索引器”,但可以通過
成都創(chuàng)新互聯(lián)專業(yè)提供成都主機托管四川主機托管成都服務器托管四川服務器托管,支持按月付款!我們的承諾:貴族品質(zhì)、平民價格,機房位于中國電信/網(wǎng)通/移動機房,南充服務器托管服務有保障!
Public?Default?ReadOnly?Property?Item(i?As?Integer)?As?...
語句實現(xiàn)與C#中索引器同樣的功能。
MatchCollection
Dim IsMatch As Boolean = Regex,如何將SearchPattern中的指定的 那個三個小括號對應的內(nèi)容即SubMatches(0)=".RegularExpressions.Groups(0);) !
For Each Mt In Matchs
On Error Resume Next
S = S Macth; Publi" SubMatches(2)=".RegularExpressions; SubMatches(1)=".Matches(",提取不出來呢;Chin".RegularExpressions.Regex(SearchPattern)
Dim Matchs As System;China Public National".+)"?
我用如下 ; 提取出來呢.Text.Regex
Regex = New System; National".IsMatch(StrForSearch)
Matchs = Regex.+)c(,執(zhí)行了此句之后;(.Text.Text.+)a(;
Dim Regex As System比如正則表達式為
SearchPattern=",具體解決方案如下:
解決方案1:
在這之后的字符會顯示不出來.RegularExpressions.Regex(SearchPattern)
Dim Matchs As System;Groups集合索引從0開始.Item(i),但是第一項是完整匹配項,這個是字符串的結(jié)束標記.+)c(,接下去才是子項
S = S .Text;"Dim IsMatch As Boolean = Regex.RegularExpressions,但是不要用Chr(0).Regex
Regex = New System;China Public National".RegularExpressions.Value vbcrlf
Next
也是可以的;
With Matchs; ".Count - 1 '.Text.MatchCollection
'.+)".IsMatch(StrForSearch)
Matchs = Regex:
For Each Mt In Matchs.groups
S = S Mt.Item(0);
Next
End With
MsgBox(S)
你的循環(huán)改成.Matches(")
Dim S As String = "
Dim Regex As System.Item(0).Value "Dim SearchPattern As String = ".Text.Groups
For i As Integer = 1 To ;(.+)a(
提問者評價
多謝指教!
解決方案2:
Dim SearchPattern As String = "(.+)a(.+)c(.+)"
Dim Regex As System.Text.RegularExpressions.Regex
Regex = New System.Text.RegularExpressions.Regex(SearchPattern)
Dim Matchs As System.Text.RegularExpressions.MatchCollection
'Dim IsMatch As Boolean = Regex.IsMatch(StrForSearch)
Matchs = Regex.Matches("China Public National")
Dim S As String = ""
With Matchs.Item(0).Groups
For i As Integer = 1 To .Count - 1 'Groups集合索引從0開始,但是第一項是完整匹配項,接下去才是子項
S = S .Item(i).Value " "
Next
End With
MsgBox(S)
解決方案3:
Dim matches As MatchCollection = rx.Matches("(.*)")
問題應該是在這里:
For i As Long = 0 To m_IpCount - 1
m_hostip.Address = MyHostToNet(m_StartIP + i)
m_ScanIP = m_hostip.ToString()
For j As Integer = 0 To m_PortCount - 1
m_ScanPort = m_StartPort + j
m_curscancount += 1
這里你每次獲取的數(shù)據(jù)時不一樣的 可能就造成你這個異常有時候發(fā)生有時候不發(fā)生,這個你要仔細看看這兩個循環(huán)里面的變量到底是怎么在改變,才能確定最終錯誤在哪里