如何验证密码文本框控件以仅允许字母和&特殊字符 [英] How to validate Password text box control to to allow only letters & special characters
本文介绍了如何验证密码文本框控件以仅允许字母和&特殊字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何验证密码只允许字母和特殊字符,为此我使用常规表达式验证,但它没有正常工作,就像我使用^ [a-zA-Z!@#$%^&*] + $但是这个代码什么失败,当我只输入信件时,它没有抛出任何类型的错误..
how to validate password to allow only letters and special character , for this i used Regular expresion validation but it was not properly working like i used ^[a-zA-Z!@#$%^&*]+$ but this code what fail when i entere only letter it was not throwing any type of err ..
推荐答案
%^&*] +
但是这个代码在我只输入信件时失败了它没有抛出任何类型的错误..
but this code what fail when i entere only letter it was not throwing any type of err ..
据我所知你至少需要一个字母和至少一个特殊字符。然后尝试这个正则表达式..希望这会有所帮助
As i understand you want at least one letter and at least one special character ..then try this regex..hope this will help
if (System.Text.RegularExpressions.Regex.IsMatch("
这篇关于如何验证密码文本框控件以仅允许字母和&特殊字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文