Possible Duplicate:
Insert string between two points with PHP
How can I replace everything between <!-- START NOT PRINT -->
and <!-- END NO PRINT -->
?
The following code works well, but whenever there are two or more instances, it goes wrong.
It then replaces everything between the first tag and the last tag. But it should remove everything between two tags which belongs together. This is my code:
$pageData['raw_content'] = preg_replace('/<!--[ ]*START[ ]*NO[ ]*PRINT[ ]*-->(.*)<!--[ ]*END[ ]*NO[ ]*PRINT[ ]*-->/si', '', $pageData['raw_content']);