I want to remove some html/js tag using "preg_replace". Here's my html tag:
<style type=text/css>' );document.write( '@media Print' );document.write( '{' );document.write( 'BODY {' );document.write( 'DISPLAY: none; print: none' );document.write( '}' );document.write( 'TABLE {' );document.write( 'DISPLAY: none; print: none' );document.write( '}' );document.write( 'TR {' );document.write( 'DISPLAY: none; print: none' );document.write( '}' );document.write( 'TD {' );document.write( 'DISPLAY: none; print: none' );document.write( '}' );document.write( '}' );document.write( '</style>' );
I want to remove tags from <style type=text/css>' )
up to ( '</style>' );
.
My code is like this:
$result3 = preg_replace("(\<style(.+?)<\/style>/", '', $result2);
But nothing gets removed when I run it.
I would appreciate your help. Also if you could explain the answer to me I would be grateful.