参考代码
Dim pattern As String = "^[01]+$"Dim txt As String = "001a010"
Dim rgx = new System.Text.RegularExpressions.Regex(pattern)If rgx.isMatch(txt) = False Then msgbox("错误")End If