C#正则表达式检测字符串(密码强度)
2009-08-05 15:25
302 查看
C# 判断是否英文或数字:
Javascript检测密码字符串强度:
Regex reg = new Regex(@"^[A-Za-z0-9]+$"); return reg.IsMatch(passwd);
Javascript检测密码字符串强度:
int intScore = 0; if (passwd.match(/[a-z]/)) { intScore = (intScore+1) } if (passwd.match(/[A-Z]/)) { intScore = (intScore+5) } if (passwd.match(//d+/)) { intScore = (intScore+5) } if (passwd.match(/(/d.*/d.*/d)/)) { intScore = (intScore+5) } if (passwd.match(/[!,@#$%^&*?_~]/)) { intScore = (intScore+5) } if (passwd.match(/([!,@#$%^&*?_~].*[!,@#$%^&*?_~])/)) { intScore = (intScore+5) } if (passwd.match(/[a-z]/) && passwd.match(/[A-Z]/)) { intScore = (intScore+2) } if (passwd.match(//d/) && passwd.match(//D/)) // [verified] both letters and numbers { intScore = (intScore+2) } if (passwd.match(/[a-z]/) && passwd.match(/[A-Z]/) && passwd.match(//d/) && passwd.match(/[!,@#$%^&*?_~]/)) { intScore = (intScore+2) } return intScore;
相关文章推荐
- 检测密码是否能过强度检测(正则表达式检测)
- C#正则表达式基础 {3,} 检测字符串是否存在 3个以上 相邻的数字
- C#正则表达式基础 {3,5} 检测字符串是否存在 3到5个连续的数字
- python使用正则表达式检测密码强度源码分享
- C#正则表达式基础 [0-9][0-9] 检测字符串是否存在两个相邻的数字
- jquery正则表达式检测密码强度
- C#正则表达式基础 检测字符串是否存在两个相邻的字母 ([a-z]|[A-Z])([a-z]|[A-Z])
- C#正则表达式基础 ^[0-9] 检测字符串的首个字符是否是数字
- python使用正则表达式检测密码强度源码分享
- C#正则表达式基础 {3} 检测字符串是否存在 3个连续的数字
- C#正则表达式基础 [0-9]$ 检测字符串是否以数字结尾
- c# 使用正则表达式对字符串进行处理
- C# 使用正则表达式去掉字符串中的数字,或者去掉字符串中的非数字
- C#中利用正则表达式获取字符串中双引号包含的内容
- C#中运用正则表达式获取字符串
- C#基于正则表达式删除字符串中数字或非数字的方法
- C# 使用正则表达式去掉字符串中的数字,或者去掉字符串中
- JS正则表达式应用——基于Jquery的验证密码强度特效
- C# 应用正则表达式过滤输入字符串
- jquery用正则表达式验证密码强度