Click here to Skip to main content
15,885,891 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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.........
Posted
Comments
lukeer 24-Sep-12 5:49am    
There is a dedicated regular expressions forum[^]. You will have better chances of getting an answer there.

1 solution

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.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900