preg_replace to add new lines at end of closing html tags
Posted: Tue Mar 18, 2008 4:50 am
Hi all,
Being as bad as I am with regular expressions, I'm hoping someone can help.
At the moment, I am doing this...
$HtmlTags = array("<tr>", "<li>", "<t", "</tr", "</tbody>", "</thead>", "</table>", etc.);
foreach($HtmlTags as $HtmlTag) $buffer = str_replace($HtmlTag, "\n".$HtmlTag, $buffer);
How can that be accomplished with preg_replace?
Thanks
Being as bad as I am with regular expressions, I'm hoping someone can help.
At the moment, I am doing this...
$HtmlTags = array("<tr>", "<li>", "<t", "</tr", "</tbody>", "</thead>", "</table>", etc.);
foreach($HtmlTags as $HtmlTag) $buffer = str_replace($HtmlTag, "\n".$HtmlTag, $buffer);
How can that be accomplished with preg_replace?
Thanks