返回列表 上一主題 發帖

高手們幫幫 regexp 求教 找特定數量的數字

高手們幫幫 regexp 求教 找特定數量的數字

大大們好 想請問用 regexp 怎麼找6個位 或8個位的數字  , 而且以2 或 3 開頭?
以下是我的未完成範例 只能找到數字

Private Function format_dn(ByVal DN As String) As String


Set oregexp = CreateObject("vbscript.regexp")
With oregexp
    .Global = True
    .IgnoreCase = True
    .Pattern = "[0-9]+"
    .MultiLine = True
   
    Set omatch = .Execute(DN)
    'MsgBox (omatch(0))
   
    For Each m In omatch
        returntext = returntext & m & vbCrLf
    Next
    format_dn = returntext
   
    'replace the number then exist a-z
    'MsgBox .Replace(DN, "")


   
End With

End Function

請高手幫幫

謝謝兩位大大的幫助

TOP

        靜思自在 : 君子立恆志,小人恆立志。
返回列表 上一主題