正则表达式至少8 +上下数字或其他非字母

标签 regex

  • 至少包含8个字符。
  • 包含大写和小写字母。
  • 包含数字或其他非字母字符。

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

    我正在创建用于更强密码的检查:)

    我正在使用的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 +上下数字或其他非字母,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6029193/

    相关文章:

    regex - Windows 中的 Perl 单行代码

    regex - 在 PowerShell 中查找和替换字符串的问题

    javascript - 验证字符串

    javascript - 允许星号的电子邮件的 JS 正则表达式

    regex - 从管道分隔文件中删除最后一列的正则表达式

    regex - 将 domain.tld/index.php 重定向到 domain.tld(删除 index.php,然后删除 301)

    javascript - Parsley.js 中的自定义正则表达式验证器

    javascript - 使用javascript从给定单词向后匹配

    C# 正则表达式 - 匹配特定字符串后跟 substring1 或 substring2

    php - 使用 Regex 匹配函数体