$pattern = '^<script.*>.*</script>$'; $codeWithOutJavaScript = ereg_replace($pattern,"",$codeWithJavaScript);