Link to home
Start Free TrialLog in
Avatar of dougbnv
dougbnv

asked on

Strip script tags

Hi

I want to strip all javascript from text with php eg:

Original = Text and other <a href = \"#\">html</a><script>blaha</script><B>blah</B>

Stripped = Text and other <a href = \"#\">html</a><B>blah</B>
Avatar of deresh
deresh

use preg_replace like this:
$src = 'Text and other <a href = \"#\">html</a><script>blaha</script><B>blah</B>';
$cleaned = preg_replace("(<script>.*<\/script>)","",$src);

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of deresh
deresh

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial