I have given a regex
let reg = new RegExp("^[-]?[0-9]*.?[0-9]{1,4}$");
console.log(reg.test("45-45")); //true
console.log(reg.test("sd545")); //true
console.log(reg.test("5*45")); //true
Expected behavior if any string or speial char it should through error
the above all console should through false What i am doing wrong?