正则表达式提取字符串中的汉字

上一篇 / 下一篇  2016-08-11 11:34:12 / 个人分类:VBScript




'global-匹配模式,true-匹配全部,fasle-匹配第一个
Function getChinessStr(global,str)
    Set reg = NewRegExp
    reg.Pattern="[\u4e00-\u9fa5]+"
    reg.Global=global
    Set macher = reg.Execute(str)
    count = macher.Count
    If(count>0) Then
        For i=0To count-1
            temp=temp&macher(i)
        Next
    EndIf
    getChinessStr = temp
EndFunction

TAG: 汉字 字符串 表达式 正则

 

评分:0

我来说两句

Open Toolbar