RE: preg_replace to delete all js code in string help needed

From: Date: Sun, 09 May 2004 15:57:09 +0000
Subject: RE: preg_replace to delete all js code in string help needed
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-185746@lists.php.net to get a copy of this message
Thanks Greg, That sorted that out nicely :-) Dave Carrera -----Original Message----- From: greg [mailto:news.php.net@gb404.com] Sent: 09 May 2004 14:17 To: Dave Carrera Subject: Re: preg_replace to delete all js code in string help needed Dave Carrera wrote: > $text2 = > preg_replace("/<script[^>]+>.*?<\/script>/is","",$text2); > > Leaves output with "language="javascript" blah blah > > Dose anyone know of a pattern that will get rid of ALL javascript from > a string. > > Thank you for any help > > Dave Carrera > > > --- > Outgoing mail is certified Virus Free. > Checked by AVG anti-virus system (http://www.grisoft.com). > Version: 6.0.679 / Virus Database: 441 - Release Date: 07/05/2004 > Try $text2 = preg_replace("/<script[^>]*>.*<\/script>/is","",$text2) It works for me. Greg --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.679 / Virus Database: 441 - Release Date: 07/05/2004 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.679 / Virus Database: 441 - Release Date: 07/05/2004

« previous php.general (#185746) next »