I have following conditions for password validation.
Password must be at least eight (8) characters in length. Password must contain both alpha and numeric characte
How about
(?>([a-zA-Z])(?!\1)){8,}
The regex to match repeated characters is /(.)\1/
.
I would simply do this as a two-step verification, no need to roll it into one regex.
As pointed out in the comments, this only lowers password entropy and thereby security though.
Thanks ..got answer ^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?!.*(.)\1).{8}$
Look aheads are your friend:
^(?=.*\d)(?=.*[a-zA-Z])(?!.*(.)\1).{8,}