- 帖子
- 79
- 主題
- 19
- 精華
- 0
- 積分
- 148
- 點名
- 0
- 作業系統
- WINDOW7
- 軟體版本
- EXCEL 2003
- 閱讀權限
- 20
- 性別
- 男
- 註冊時間
- 2017-5-21
- 最後登錄
- 2023-3-13
|
高手們幫幫 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
請高手幫幫 |
|