- preg_match: documentation ( source)
- var_export: documentation ( source)
<?php
$html = <<<HTML
<link rel="stylesheet" href="/html_5/tags/html_link_tag_example.css">
HTML;
$el = 'li';
var_export(preg_match('/(<'.$el.'(.*?)>)((\n*?.*?\n*?)<\/'.$el.'>|)/', $html, $out) ? $out : []);