I have a question about regular expressions in vba. I looked it up on vba and found that it doesn't read afterwards.
[~~~]
Could you tell me how to avoid reading after matching only the characters in parentheses?
SubMatches
can be taken out by grouping using parentheses such as (.*?)
.
Sub button 1_Click()
Dimre As RegExp
Set = New RegExp
re.Pattern="[(.*?)]"
Set matches=re.Execute("hoge[fuga]piyo")
MsgBox matches.Item(0).SubMatches(0)'"fuga" appears.
End Sub
References
Use regular expressions in VBA (RegExp object method)
© 2024 OneMinuteCode. All rights reserved.