Removendo todos os comentários em html, exceto os comentários do Internet Explorer usando regex e php
Sou novo em regex, mas preciso de um código que remova todos os comentários html <!-- here -->
), mas não comentários do Internet Explorer como <!--[if IE 7]> here <![endif]-->
). Eu tenho este código: 369
<?php
function stripTags($text, $tags)
{
// replace the internet explorer comments tags so they do not get stripped
$text = preg_replace("<!--[if IE7] (.*?) <![endif]-->", "#?#", $text);
// replace all the normal html comments
$text =preg_replace('/<!--(.|\n)*?-->/g', '', <?php
function stripTags($text, $tags)
{
// replace the internet explorer comments tags so they do not get stripped
$text = preg_replace("<!--[if IE7] (.*?) <![endif]-->", "#?#", $text);
// replace all the normal html comments
$text =preg_replace('/<!--(.|\n)*?-->/g', '', $&text);
// return internet explorer comments tags to their origial place
$text = preg_replace("@#\?#@", "<!--[if IE7] (.*?) <![endif]-->", $text);
return $text;
}
?>
amp;text);
// return internet explorer comments tags to their origial place
$text = preg_replace("@#\?#@", "<!--[if IE7] (.*?) <![endif]-->", $text);
return $text;
}
?>
Qualquer ajuda, por favo