1
Answer

Regular Expression for strong password

Shrikant Palla

Shrikant Palla

14y
3.6k
1
Hi all,

I have a requirement where i used regular expression in asp.net application which will validate the password entered by the user based on some conditions.

1) Minimum password length should be 8.
2) Must contain alphanumeric with minimum 3 numerics (numerics can be anywhere in the string like 1bc23ef#@,123@abcd,abcd!@123).

I have used the below expression
^.*(?=.{8,})(?=.*[a-zA-Z0-9])(?=.*\d{3}).*$

bt it fails as it is accepts the below pattern 
1) 123456789 

it does not accept if i enter the password as abc1ef32!@ 
but works if i give as 123@abcd or abcd!@#123

any help is highly appreciated.





Answers (1)