vbs:能算出一个字符在一字段里共出现有几次的函数
程序员文章站
2022-03-27 12:09:27
function regexptest(patrn, strng) dim regex, matches s...
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"))
下一篇: 手机自带变声器 效果好到队友都被骗了