I am working on setting up password validation requirements to ensure the field contains:
Both uppercase letters, lowercase letters, numbers and special characters
This is my current progress:
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 include a check for special characters as well
}
}
}
The existing code covers only letters and numbers combinations. What additional steps are needed to verify if special characters have been entered by the user?
Special characters should include: !@#$%^&*()_+
(input via shift key + number keys 0-10)