我仍在使用vb.net学习dekstop编程 现在我学习正则表达式模式,我可以使用正则表达式模式确定大写字母" [A-Z]"和更多。但如何使用正则表达式模式确定标点字符?
标点字符: !"#\ $%&安培;'()* +, - /:;?< => \ @ [\] \ ^ _`{\ |}〜
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
谢谢你。
答案 0 :(得分:1)
只需使用此正则表达式:
[\W_0-9]
\W
会检查a-z
A-Z
和_
以外的所有字符。
上述正则表达式将起作用。