VB.NET code
Public Class Form3
Private ReadOnly InvalidChars As String = "[" + System.Text.RegularExpressions.Regex.Replace(""";&^%$#", ".", "\$&") + "]"
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim s As String = "有特殊字符哦"
If System.Text.RegularExpressions.Regex.Match(s, InvalidChars).Success Then
MessageBox.Show("有特殊字符")
Else
MessageBox.Show("没有特殊字符")
End If
End Sub
End Class
參考網址:
沒有留言:
張貼留言