計算一個字符串在另一字符串中出現(xiàn)的次數(shù)函數(shù)
更新時間:2008年03月06日 21:37:40 作者:
計算一個字符串在另一字符串中出現(xiàn)的次數(shù)函數(shù)
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
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
相關文章
javascript將字符串中的多個空格替換為一個空格的正則實例
這篇文章主要介紹了javascript將字符串中的多個空格替換為一個空格的正則實例,需要的朋友可以參考下2016-12-12

JS正則表達式匹配檢測各種數(shù)值類型(數(shù)字驗證)
這篇文章主要介紹了JS正則表達式匹配檢測各種數(shù)值類型(數(shù)字驗證)的相關資料,非常不錯,具有參考借鑒價值,需要的朋友參考下吧
2016-08-08