/^ : Start
(?=.{8,}) : Length
(?=.*[a-zA-Z]) : Letters
(?=.*d) : Digits
/^(?=.*[!#$%&?*^()~` "])$/ : Special characters
$/ : End
(/^
(?=.*d) //should contain at least one digit
(?=.*[a-z]) //should contain at least one lower case
(?=.*[A-Z]) //should contain at least one upper case
[a-zA-Z0-9]{8,} //should contain at least 8 from the mentioned characters
$/)
Example:- /^(?=.*d)(?=.*[a-zA-Z])[a-zA-Z0-9]{7,}$/
const regexPass = /(?=.*[!#$%&?^*@~() "])(?=.{8,})/;
//eight char or longer and must have a special character