My regex code is not operation.
Input string:
let question = "THIS IS MALICIOUS <h1>OOGA</h1>"
Faulty Code:
question = question.replace(/^[a-zA-Z0-9?!.]+$/g, "");
Output string:
"THIS IS MALICIOUS </h1>OOGA</h1>"
Correct / Expected Output string:
"THIS IS MALICIOUS OOGA"
>Solution :
please try with following code
let question = "THIS IS MALICIOUS <h1>&OOGA</h1>"
question = question .replace(/<[^>]*>/g, "")