How to extract text using regex in vb6
如何在vb6中使用regex提取文本
Dim MyText As String
MyText = "anything [*]textToExtract[*] anything"
Result Should Be :
结果应该是:
textToExtract
textToExtract
1 个解决方案
#1
3
Sub test()
Dim re As RegExp, m As MatchCollection
Set re = New RegExp
Dim MyText As String, extractedText As String
MyText = "anything textToExtract anything"
re.Pattern = "anything (.*) anything"
Set m = re.Execute(MyText)
extractedText = m(0).SubMatches(0)
End Sub
#1
3
Sub test()
Dim re As RegExp, m As MatchCollection
Set re = New RegExp
Dim MyText As String, extractedText As String
MyText = "anything textToExtract anything"
re.Pattern = "anything (.*) anything"
Set m = re.Execute(MyText)
extractedText = m(0).SubMatches(0)
End Sub