我想只允許字母數字密碼,我已經寫了下面的代碼,以匹配相同 但同樣沒有工作只允許字母數字字符
Regex.IsMatch(txtpassword.Text,「^ [A-ZA -Z0-9 _] * $「)即使我輸入密碼測試(不包含任何數字),也不會返回假 。
ElseIf Regex.IsMatch(txtpassword.Text, "^[a-zA-Z0-9_]*$") = False Then
div_msg.Attributes.Add("class", "err-msg")
lblmsg.Text = "password is incorrect"
I have tried this also
Dim r As New Regex("^[a-zA-Z0-9]+$")
Dim bool As Boolean
bool = r.IsMatch(txtpassword.Text) and for txtpassword.Text = '4444' , bool is coming true i dont know what is wrong.
你在使用Windows或Web應用程序....... –
調試時'txtpassword.Text'的值是什麼? –
http://stackoverflow.com/questions/910063/allow-only-alphanumeric-in-textbox 可能是這可以幫助你一點。 –