Function strnum(patrn, strng) Dim regEx, Match, Matches,xx xx=0 Set regEx = New RegExp regEx.Pattern = patrn regEx.IgnoreCase = True ' 設置是否區(qū)分大小寫。 regEx.Global = True Set Matches = regEx.Execute(strng) For Each Match in Matches xx=xx+1 Next strnum = xx End Function