求正则表达式的写法、

2025-06-27 23:48:24
推荐回答(1个)
回答1:

Private Sub Command1_Click()
Dim regEx, Match, Matches '建立变量。
Set regEx = New RegExp '建立正则表达式。
regEx.Pattern = "

(.*)

" ' 设置模式。
regEx.IgnoreCase = True '设置是否区分大小写。
regEx.Global = True '设置全程可用性。
Set Matches = regEx.Execute(Text1.Text) '执行搜索。
For Each Match In Matches ' 遍历 Matches 集合。
Text2 = Text2 & Match.SubMatches(0) & ":" & Match.SubMatches(1) & vbCrLf
Next
End Sub
Match.SubMatches(0) 和 Match.SubMatches(1) 分别是htm文件编号和链接的文字。