Forum Moderators: coopster
Are you supposed to escape any of the characters in an html comment?
preg_match("/<title>(.*)<\/title>/i", $source, $tag_contents);
$title = $tag_contents[1];
echo $title;
the backslash at <\/title> is escaping the /. If you're leaving that out, so you wind up with:
preg_match("/<!--begin_first-->(.*)<!--end_first-->/i", $source, $tag_contents);
then it should work. If you're leaving that backslash in, that's where the problem is.
preg_match("/<!--beginfirst-->(.*)<!--endfirst-->/i", $source, $tag_contents);
$title = $tag_contents[1];
echo $title;
my html looks like this:
<div id="content">
<a name="skip"></a>
<!--beginfirst-->
<div id="first_learn">
<p>First paragraph from learn.html.</p>
</div>
<!--endfirst-->
<p>Maecenas mattis varius lorem.</p>
</div>
<!--end #content-->