当前位置:主页 > 查看内容

vbs:能算出一个字符在一字段里共出现有几次的函数

发布时间:2021-07-22 00:00| 位朋友查看

简介:FunctionRegExpTest(patrn,strng) DimregEx,Matches SetregEx=NewRegExp regEx.Pattern=patrn regEx.IgnoreCase=True‘为真则忽略大小写,否则严格匹配大小写 regEx.Global=True SetMatches=regEx.Execute(strng) RegExpTest=Matches.count EndFunction MsgB……
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"))  


原文链接:https://m.jb51.net/article/9226.htm
本站部分内容转载于网络,版权归原作者所有,转载之目的在于传播更多优秀技术内容,如有侵权请联系QQ/微信:153890879删除,谢谢!

推荐图文


随机推荐