至少 8 + 上下+数字或其他非字母的正则表达式 [英] Regex for at least 8 + upper and lower+numbers or other non-alphabetic

查看:34
本文介绍了至少 8 + 上下+数字或其他非字母的正则表达式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  1. 至少包含 8 个字符.
  2. 包含大小写字母.
  3. 包含数字或其他非字母字符.

上述标准的正则表达式是什么?

What could be the reg ex for the above criteria?

我正在创建一个更强密码的检查:)

I am creating a check for stronger password :)

我正在使用的 c#

推荐答案

应该这样做:

(?=.*?[a-z])(?=.*?[A-Z])(?=.*?[^a-zA-Z]).{8,}

参见此处:rubular

说明:

(?=.*?[a-z]) //lookahead, there has to be a lower case alphabetic char
(?=.*?[A-Z]) //lookahead, there has to be a upper case alphabetic char
(?=.*?[^a-zA-Z]) //lookahead, there has to be a non-alphabetic char
.{8,} // any character at least 8 times

这篇关于至少 8 + 上下+数字或其他非字母的正则表达式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆