Dim str1 As String = "00001,00002,00003" Dim str2 As String = "" For Each s As String In str1.split(",") str2 &= "[0-9]{5}," Next str2 = "^" & str2.trim(",") & "$" Dim rgx = new System.Text.RegularExpressions.Regex(str2, System.Text.RegularExpressions.RegexOptions.IgnoreCase) If rgx.isMatch(str1) Then msgbox("匹配") Else msgbox("不匹配") End If