【问题标题】:Regular Expression Password Sylius (regex)正则表达式密码 Sylius (regex)
【发布时间】:2017-05-10 14:58:13
【问题描述】:

我想在 Sylius 上设置密码模式。 我愿意:

  1. 8 个字符(分钟)
  2. 1 个小写字母(分钟)
  3. 1 个大写(最小)

所以我做了这个正则表达式:

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

但是我不知道我必须把它放在哪里来设置我的密码条件

感谢您的宝贵时间

【问题讨论】:

标签: php regex symfony bundle sylius


【解决方案1】:

希望这个正则表达式能帮到你。

正则表达式: ^(?=.*[a-z])(?=.*[A-Z]).{8,}$

1. ^ 字符串开头

2. (?=.*[a-z]) 小写字符的正向预测

3. (?=.*[A-Z]) 正向向前看大写字符

4. .{8,}$ 匹配8 或更多字符直到最后。

Regex demo

PHP 代码: Try this code snippet here

<?php
ini_set("display_errors", 1);
$string="SahilGul";
if(preg_match('/^(?=.*[a-z])(?=.*[A-Z]).{8,}$/', $string))
{
    echo "Password pattern matched";
}

【讨论】:

    猜你喜欢
    • 2014-10-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-07-25
    • 2023-03-06
    • 2010-11-18
    • 2017-02-23
    相关资源
    最近更新 更多