需要一个preg替换表达式来替换多个str_replace来清理一些脚本

I am working with a script obfuscation class to output stored javascripts as a strings into a singlular output.

the problem is that customers of course will copy in the or

I am currently using

    $script = str_replace('</script>', "", $script);
    $script = str_replace('<script>', "", $script);
    $script = str_replace('<script type="text/javascript">', "", $script);

But would love to use a preg_replace expression to handle it.

basically <script + anything up to the > and </script> would need to be removed.

I am not very familiar with regular expressions syntax as I have not worked with them in them much.

I do not want to use dom just in case that was going to be a suggestion.

Thanks in advance for any assistance.

You can put them into array:

 $replaces = array("</script>", "<script>", '<script type="text/javascript">');

 str_replace($replaces, "", $text)

or

preg_replace("/<\/?script.*?>/i", "", $text)