vbs:能算出一个字符在一字段里共出现有几次的函数
时间:2021-03-07 10:30:59|栏目:|点击: 次
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"))
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"))
栏 目:
下一篇:Powershell小技巧之通过EventLog查看近期电脑开机和关机时间
本文标题:vbs:能算出一个字符在一字段里共出现有几次的函数
本文地址:http://www.codeinn.net/misctech/75941.html






