// remove HTML comments (not containing IE conditional comments).
$this->_html = preg_replace_callback(
'/<!--([\\s\\S]*?)-->/'
,array($this, '_commentCB')
,$this->_html);
<!--noindex-->
и <!--/noindex-->
// remove HTML comments (not containing IE conditional comments).
$this->_html = preg_replace_callback(
'#<!--(?!/?noindex)(.*?)-->#s'
,array($this, '_commentCB')
,$this->_html);
$allow_comments = [
'noindex',
'/noindex'
];
$this->_html = preg_replace_callback(
'/<!--([\\s\\S]*?)-->/',
function ($matches) use($allow_comments) {
[$match, $com] = $matches;
return in_array($com, $allow_comments) ? $match : '';
},
$this->_html
);