今天工作使用到,所以就解決了這個問題,標記下來:
Dim reInfo As RegExp '正則對象
Dim MatchInfo As MatchCollection, objMatch As Match, objSubMatch As SubMatches
……
Set MatchInfo = reInfo.Execute(ShopInfo) 'MatchInfo是結果集合
Set objMatch = MatchInfo.Item(1) 'objMatch是單個的返回結果
Set objSubMatch = objMatch.SubMatches 'objSubMatch是子結果集合,當pattern使用擴號時擴號的匹配項將保存在objSubMatch裏。
Me.MSFlexGrid.TextMatrix(r, 1) = objSubMatch(1)
如:strPattern = "<b>(別名|地址|電話)/:</b> (.+)<br />"
匹配:<b>電話:</b> 010-640718<br />
結果:objSubMatch(0) = 電話 objSubMatch(1) = 010-640718 objMatch ="<b>電話:</b> 010-640718<br />"
Dim reInfo As RegExp '正則對象
Dim MatchInfo As MatchCollection, objMatch As Match, objSubMatch As SubMatches
……
Set MatchInfo = reInfo.Execute(ShopInfo) 'MatchInfo是結果集合
Set objMatch = MatchInfo.Item(1) 'objMatch是單個的返回結果
Set objSubMatch = objMatch.SubMatches 'objSubMatch是子結果集合,當pattern使用擴號時擴號的匹配項將保存在objSubMatch裏。
Me.MSFlexGrid.TextMatrix(r, 1) = objSubMatch(1)
如:strPattern = "<b>(別名|地址|電話)/:</b> (.+)<br />"
匹配:<b>電話:</b> 010-640718<br />
結果:objSubMatch(0) = 電話 objSubMatch(1) = 010-640718 objMatch ="<b>電話:</b> 010-640718<br />"