您可以使用该Split()方法,或者对于更复杂的匹配,您可以使用该"vbscript.regexp"对象:
Sub NewRegex()
Dim reg
Dim matches, match, tmpStr As String
Set reg = CreateObject("vbscript.regexp")
tmpStr = "blah bla ...."
With reg
.IgnoreCase = True
.MultiLine = False
.Pattern = "your regex pattern goes here"
.Global = True
End With
Set matches = reg.Execute(tmpStr)
For Each match In matches
MsgBox match
Next mt
End Sub
Run Code Online (Sandbox Code Playgroud)
以下是有关在 VBA 中使用正则表达式的教程:在 Excel 中使用正则表达式 (RegExp)
| 归档时间: |
|
| 查看次数: |
13482 次 |
| 最近记录: |