Click here to Skip to main content
15,890,609 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i want to validate the password when the user is registering,

That password must contain one special character one number like that


any one help me please
Posted

1 solution

(?=^.{8,}$)
This part means has 8 more more characters, and the match starts at the start of input.

((?=.*\d)
Means contains a digit.

|(?=.*\W+))
Or contains something that is neither a letter or a digit

(?![.\n])
not starting with a dot or UNIX newline.

(?=.*[A-Z])
Contains at least one capital letter.

(?=.*[a-z])
Contains at least one lowercase letter

.*$
Consists entirely of non-newline characters and the matched group will contain the entire string.

For alternatives, have a look:
Here[^]
Here[^]
and Here[^]
 
Share this answer
 
Comments
codeBegin 14-May-12 6:57am    
Nice one, 5+!

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