I was able to write a regex to validate the below criterias for an input box.
Regex -> ^(?=.*[0-9])(?=.*[a-z])(?=.*[A-Z])(?=.*[+=!@#$%^&*])(?=\\S+$).{14,}$
However, this regex allows other special characters which are not mentioned. I want to restrict all the special characters except these +=!@#$%^&*
could someone help me to modify the given regex with the above criteria?
Instead of .
that allows any character you can use a character set to restrict the allowed characters to a specific set:
^(?=.*[0-9])(?=.*[a-z])(?=.*[A-Z])(?=.*[+=!@#$%^&*])(?=\\S+$)[0-9A-Za-z+=!@#$%^&*]{14,}$