I've got a question I was hoping I could have answered, it pertains to a regexp and removing html comment tags.
I'll provide a test case and then ask my question.
Example 1.
$html = '<p><!-- start: date -->30-10 Oct 2008<br /><!-- end: date --><!-- start: date -->31-07 Jan 2008<br /><!-- end: date --><!-- start: date -->05-12 Jul 2008<br /><!-- end: date --></p>';
$html = preg_replace('/<!-- \w+:? (.)* -->/', '', $html);
echo $html;
Example 2.
$html = '<p>
<!-- start: date -->30-10 Oct 2008<br /><!-- end: date -->
<!-- start: date -->31-07 Jan 2008<br /><!-- end: date -->
<!-- start: date -->05-12 Jul 2008<br /><!-- end: date -->
</p>';
$html = preg_replace('/<!-- \w+:? (.)* -->/', '', $html);
echo $html;
If you compare the output from both those test cases you'll notice example 1 doesn't print the dates, whereas example 2 does.
So my question is how can I refactor this expression to only remove the html comment and not have to worry about there being linebreak within my html for each comment to be removed correctly?
Thanks in advance.