views:

98

answers:

2

Hi,

can any one help me in creating a regular expression for password validation.

The Condition is "Password must contain 8 characters and at least one number, one letter and one unique character such as !#$%&? "

+6  A: 
^.*(?=.{8,})(?=.*[a-zA-Z])(?=.*\d)(?=.*[!#$%&? "]).*$

---

^.*              : Start
(?=.{8,})        : Length
(?=.*[a-zA-Z])   : Letters
(?=.*\d)         : Digits
(?=.*[!#$%&? "]) : Special characters
.*$              : End
Macmade
+1 for explanation - tested with a few examples and works at http://www.regular-expressions.info/javascriptexample.html
amelvin
Jasim
Don't forget to escape necessary characters...
Macmade
i didn't got that?? could you be more specific??
Jasim
Macmade
its working now..thnx forthat
Jasim
+2  A: 
Richard