Something
public text v1 · immutable<?
$thisrecord =
"
<h3 id=\"%%recordid%%\">%%headline%%</h3>
<ifpicture>
<img src=\"/images/upload/%%recordid%%.jpg\" alt=\"%%picturecaption%%\" />
<span class=\"caption\">%%picturecaption%%</span>
</ifpicture>
<p>%%textbody%%</p>
";
echo htmlspecialchars($thisrecord);
$resultcount = preg_match_all("(<ifpicture>.*?</ifpicture>)",$thisrecord,$results);
echo "<p>Found $resultcount match(es).</p>";
?>