密码只接受一次不超过一次的特殊字符 [英] password accepting special characters only once not more than once

查看:120
本文介绍了密码只接受一次不超过一次的特殊字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

我的要求是密码允许使用字母,数字和任何特殊字符.但是特殊字符只能在密码中输入一次.我想要该javascript的正则表达式.任何人都可以帮助我获取该表达式.


预先感谢.........

Hello,

my requirement is password allows alphabets ,numbers and any special characters.but the special character will allows once in the password not more than once.i want regular expression for that ion javascript.can anyone pls help me to get the expression.


Thanks in advance.........

推荐答案

Regexp是一个功能强大的工具,可用于检查密码的复杂性.环顾四周: http://www.zorched.net/2009 /05/08/password-strength-validation-with-regular-expressions/ [
假设特殊字符集仅包含"@".检查一个并且只有一个的前瞻模式如下所示:
^(?=([^@]*[@][^@]*
Regexp is a powerful tool, and can be used to check a password for it''s complexity. Look around here: http://www.zorched.net/2009/05/08/password-strength-validation-with-regular-expressions/[^]. As you did not said anything about the password policy. What you mean by "special characters". What about the other character classes, and password length? Thus you have to fine-tune the expression from the above link.

Let''s suppose, that the special character set contains only the "@". The lookahead pattern that check for one and only one of it looks like this:
^(?=([^@]*[@][^@]*


)).*



您可以使用这种方法从上方扩展页面上显示的先行顺序.

You can use this approach to extend the lookahead sequence presented on the page from above.


这篇关于密码只接受一次不超过一次的特殊字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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