返回列表 上一主題 發帖

如何設定REGEXP PATTERN才能取出正確資料呢?

用 “正規表示式”可以做很多事, 例如
尋找字串中的中文字

Function CountDblChr(ByVal sCh As String) As Integer

    Set re = CreateObject("vbscript.regexp")

    're.Pattern = "[\u4e00-\u9fa5]" '判斷中文字(包括特殊字,但不包括符號。和數字如1)

    re.Pattern = "[^\x00-\xff]" '判斷所有的全形字

    re.Global = True

    re.IgnoreCase = True

    Set matches = re.Execute(sCh)

    CountDblChr = matches.Count

    Set re = Nothing

End Function
ss

TOP

回復 9# dechiuan999
有個好的網站,但很久沒有上了.找到再po上
ss

TOP

        靜思自在 : 能幹不幹,不如苦幹實幹。
返回列表 上一主題