if (text.includes("<script/( |<([^>]+)>)/></script>")) {
alert("isset script");
}
const parseHTML = html => {
const root = document.implementation.createHTMLDocument();
root.body.innerHTML = html;
return root.body.children[0];
}
const text = `
<div>
<h1>Text</h1>
<script>
console.log("!");
</script>
</div>
`;
if (parseHTML(text).querySelector('script')) {
alert('isset script')
}