<?php
header("Content-Type: text/plain; charset=utf-8"); ?>
<?php
$text = <<<TEXT
<b><!-- <i> это комментарий --><div class="1"><x это битый тег и он не считается <r><a><c><eee><ff><!-- распознается ли? -->
<!--
1
2
3
а это комментарий а не тег <tag>
4
5
6
-->
TEXT;
$commentPattern = "/(<!--)(\\s)*.*?(\\s)*(-->)/u";
$pattern = "/(<([\w]+)[^<]*>)/";
foreach ($new as $key => $value) {
echo $new[$key][2] . "\n";
}
PD9waHAKaGVhZGVyKCJDb250ZW50LVR5cGU6IHRleHQvcGxhaW47IGNoYXJzZXQ9dXRmLTgiKTsKPz4gCjw/cGhwCgptYl9pbnRlcm5hbF9lbmNvZGluZygiVVRGLTgiKTsKJHRleHQgICAgICAgICAgID0gPDw8VEVYVAogICAgICAgPGI+PCEtLSA8aT4g0Y3RgtC+INC60L7QvNC80LXQvdGC0LDRgNC40LkgLS0+PGRpdiBjbGFzcz0iMSI+PHgg0Y3RgtC+INCx0LjRgtGL0Lkg0YLQtdCzINC4INC+0L0g0L3QtSDRgdGH0LjRgtCw0LXRgtGB0Y8gPHI+PGE+PGM+PGVlZT48ZmY+PCEtLSDRgNCw0YHQv9C+0LfQvdCw0LXRgtGB0Y8g0LvQuD8gLS0+Cgo8IS0tIAoxCjIKMwrQsCDRjdGC0L4g0LrQvtC80LzQtdC90YLQsNGA0LjQuSDQsCDQvdC1INGC0LXQsyA8dGFnPiAKNAo1CjYKLS0+CgoKVEVYVDsKJGNvbW1lbnRQYXR0ZXJuID0gIi8oPCEtLSkoXFxzKSouKj8oXFxzKSooLS0+KS91IjsKJHR4dCAgICAgICAgICAgID0gcHJlZ19yZXBsYWNlKCRjb21tZW50UGF0dGVybiwgJycsICR0ZXh0KTsKJHBhdHRlcm4gICAgICAgID0gIi8oPChbXHddKylbXjxdKj4pLyI7CnByZWdfbWF0Y2hfYWxsKCRwYXR0ZXJuLCAkdHh0LCAkbmV3LCBQUkVHX1NFVF9PUkRFUik7CmZvcmVhY2ggKCRuZXcgYXMgJGtleSA9PiAkdmFsdWUpIHsKICAgIGVjaG8gJG5ld1ska2V5XVsyXSAuICJcbiI7Cn0K