匹配,正则表达式

Function isEng(ifEng As String) As Integer
'判断是否英文
isEng = 0
With CreateObject("VBSCRIPT.REGEXP")
.Global = True
.Pattern = "[a-zA-Z]"
If .test(ifEng) Then
isEng = 1 'MsgBox "1" ,是英文
Else
isEng = 0 'MsgBox "0"
End If
End With
End Function

Function isThreeNum(judge As String) As String
'判断是否为数字
With CreateObject("VBSCRIPT.REGEXP")
.Global = True
.Pattern = "[0-9]"
If .test(judge) Then
MsgBox "yes", vbInformation, "友情提示"
Else
MsgBox "no", vbInformation, "友情提示"
End If

End With

End Function

原文地址:https://www.cnblogs.com/AntipasChen/p/7154500.html