Reputation: 27
i am still learning dekstop programming using vb.net Now iam learning about regex pattern, i can determine capital letter using regex pattern "[A-Z]" and more. but how to determine Punctuation characters using regex pattern?
Punctuation characters : !"#\$%&'()*+,-./:;<=>\?@[\]\^_`{\|}~
Public Sub UniqueKeyCodeStrengthCalculator()
If Regex.IsMatch(keycode, "[A-Z]") Then
MsgBox("Contain Capital Letter")
ElseIf Regex.IsMatch(keycode, "\d") Then
MsgBox("Contain number")
ElseIf Regex.IsMatch(keycode, "[a-z]") Then
MsgBox("Contain Non-capital Letter")
End If
End Sub
thank you before.
Upvotes: 1
Views: 308
Reputation: 59252
Just use this regex:
[\W_0-9]
\W
checks for all characters other that a-z
A-Z
and _
.
The above regex will work.
Upvotes: 1