I have function like this in Angular:
checkRegex() {
setTimeout(() => {
const regex = /^(?=.{8,})(?=.[A-Z])(?=.[a-z])(?=.[0-9])(?=.[!@#$%^&()=])([a-zA-Z0-9!@#$%^&()=-]+)$/g;
let checkListCondition = this.listCondition[0];
let checkValue = checkListCondition.value[0]
const matchRegex = checkValue.test(regex)
if (matchRegex) {
this.state.disableGroup.submitButton = false;
} else {
this.state.disableGroup.submitButton = true;
}
console.log('checkValue', checkValue);
}, 10);
}
my expection is if I enter value like this:
<test'
this.state.disableGroup.submitButton will return false and if I enter value like this:
(succes^
this.state.disableGroup.submitButton will return true
In my code, can you help me find where is my mistake? thank you. my current code is not work. I need your help guys