function onChange(control, oldValue, newValue, isLoading) { if (isLoading || newValue == '') { return; } g_form.hideErrorBox('password'); var pattern =/(?=(.*[0-9]))(?=.*[\!@#$%^&*()\\[\]{}\-_+=~`|:;"'<>,./?])(?=.*[a-z])(?=(.*[A-Z]))(?=(.*)).{8,}/ ; // regex pattern if(!pattern.test(newValue)){ g_form.showErrorBox('password', getMessage('Password Should have 1 lowercase letter, 1 uppercase letter, 1 number, 1 special character and be at least 8 characters long'));//show error messege g_form.setValue('password', ''); } }
Regex Strong Password Validation( Should have 1 lowercase letter, 1 uppercase letter, 1 number, 1 special character and be at least 8 characters long)
Working Code Edited question July 24, 2023