Function RegExpTest(patrn, strng)
Dim regEx, Matches
Set regEx = New RegExp
regEx.Pattern = patrn
regEx.IgnoreCase = True ‘為真則忽略大小寫,否則嚴格匹配大小寫
regEx.Global = True
Set Matches = regEx.Execute(strng)
RegExpTest = Matches.count
End Function
MsgBox(RegExpTest(“is.”, “IS1 is2 IS3 is4”))