Regex to allow exactly one special character in password. Also have regex to restrict some other special characters in password.
Below Regex will allow only one special character out of given set [!@#$%_].
^(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])(?=[^!@#$%_]*[!@#$%_][^!@#$%_]*$)[a-zA-Z0-9!@#$%_]{8,}$
If want to restrict few special characters then, below Regex can be used where currently [+-] is restricted.
^(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])(?!.*[+-])(?=[^!@#$%_]*[!@#$%_][^!@#$%_]*$)[a-zA-Z0-9!@#$%_]{8,}$