( # Start of group
(?=.*\d) # must contain at least one digit
(?=.*[A-Z]) # must contain at least one uppercase character
(?=.*\W) # must contain at least one special symbol
. # match anything with previous condition checking
{8,8} # length is exactly 8 characters
) # End of group
In one line:
((?=.*\d)(?=.*[A-Z])(?=.*\W).{8,8})
You need to match entire input string. So, you can enclose the regex between ^
and $
to prevent accidentally assuming partial matches as matching entire input:
^((?=.*\d)(?=.*[A-Z])(?=.*\W).{8,8})$