Hello, can somebody give me an example of how to write an preg_replace, that will complete remove everything inside an <style .... </style> tag everything i found on the net is not working thanks
OK, not must but better maybe preg_quote If we have $MyRegExp="/<style>/"; to simplify: $MyRegExp="/<style>/"; echo preg_quote($MyRegExp)."\n"; PHP: Echoed However, this simple example gave warning and I'll check why when I've time for this. Regards
It's certainly odd, that's for sure. I've never had to escape < or > and I've used the preg_ functions more times than I can count. Sure enough though, preg_quote escapes those characters.
sorry, meant: preg_replace("/<style[^>]*?>(.*?)<\/style>/Uis",'$1',$html); PHP: Posted that last night and was tired. @koko5 test this: <?php $html = <<<HTML <style> blahblah... </style> HTML; echo preg_replace("/<style[^>]*?>(.*?)<\/style>/Uis",'$1',$html); ?> PHP: