Q:

Angular2 password validation with special characters

I would like to setup validation for password field to contain:

Both capital letters, small letters, numbers and special characters

This is what I have so far:
passwordValueValidator(control) {
  if (control.value != undefined) {
    if (!control.value.match(/^(?=.*[0-9])[a-zA-Z0-9!@#$%^&*]{6,100}$/)) {
      return { 'invalidPassword': true };
    }
    else{
      //here i need to add check for special characters
    }
  }
}

The above code works with only letters and numbers combinations. What else do I need to add to also check if a user has entered the special characters
Special characters are: !@#$%^&*()_+ (enterd by shift + numbers 0-10)

A:

Try this one: 
/^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[!@#\$%\^&\*])(?=.{6,100})/

