I'm writing a regular expression to validate a password. The conditions are:
Password must contain at least two special characters
Password must be at least eight characters long
- Password must be alpha numeric
I'm able to make sure that there are atleast 8 characters, atleast one alphabet, atleast one number and atleast one special character using the below Regular expression:
(?=.*[A-z])(?=.*[0-9])(?=.*?[!@#$%\^&*\(\)\-_+=;:'""\/\[\]{},.<>|`]).{8,32}
Only condition i'm not able to get is there must be atleast two special characters (Above Reg exp is atleast one special characters). Does anyone have any idea on this?
Thanks in advance.
.{8,}
would be enough. – Avinash Raj Mar 25 '15 at 12:03