-2

I've 2 (or more) script tag in my html page, and i want to remove (replace with ' ') them, which one has myfunc in its content (only script tags). an example:

<html>
<head>
<title>Test</title>
<script type="text/javascript">
    function myfunc(){
        ...
        ...
        ...
    }
</script>
<script type="text/javascript">
    alert("Hello World!");
</script>
<script type="text/javascript">
    alert(myfunc());
</script>
</head>
</html>

I'm looking for a RegEx to do that, for php preg_replace.

Thank you, very much.

Alan Moore
  • 73,866
  • 12
  • 100
  • 156
mrdaliri
  • 7,148
  • 22
  • 73
  • 107
  • Where are you getting the HTML from? If the PHP script is the one outputting it then why don't you just not output the ` – Tarek Fadel Sep 08 '11 at 04:05
  • possible duplicate of [How to parse HTML with PHP?](http://stackoverflow.com/questions/3650125/how-to-parse-html-with-php) – ajreal Sep 08 '11 at 04:07
  • @Tarek: it's a part of my html page, I import the page's code into my php program, change and replace that, and save it again. – mrdaliri Sep 08 '11 at 04:08

1 Answers1

1

<script type=\"text\/javascript\">(.*myfunc\(\).*?)<\/script>

replace it with

\1

Rolando Cruz
  • 2,834
  • 1
  • 16
  • 24