Dim str As String = “12345” Dim reg1 As new System.Text.RegularExpressions.Regex("^[a-zA-Z]+$") Dim reg2 As new System.Text.RegularExpressions.Regex("^[0-9]+$") If reg1.Ismatch(str) = True Then msgbox("是字母") ElseIf reg2.Ismatch(str) = True Then msgbox("是数字") End If