vbs:能算出一个字符在一字段里共出现有几次的函数
程序员文章站
2022-07-02 20:10:55
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"))