My question is now moot. I found a way to reformat the PCRE and replace it all with variations of str_replace().
Here is an abridged version of what my code now looks like
PHP Code:
<?php
$i=1;
$summary = explode("CODE",$summary);
$a=count($summary);
while ($i<$a)
{
#### change the [CODE] areas to display returns.
$summary[$i] = htmlentities($summary[$i]);
$summary[$i] = str_replace("\r\n","<br>",$summary[$i]); // goes to next line and to the leftmost margin
$summary[$i] = str_replace(" "," ",$summary[$i]);
$i=$i+2;
}
$i=0;
while ($i<$a)
{
if ($i%2 == 0)
{
####changes the non [code] sections to display returns
$k="**";
$summary[$i]=str_replace("\r\n","<br>",$summary[$i]);
$summary[$i]=str_replace(' ',"$k",$summary[$i]);
}
else $summary[$i]= "<div class=withborder>$summary[$i]</div>"; #### adds CSS to the [CODE] areas.
$i=$i+1;
}
$summary = implode (" ",$summary);
echo "$summary";
?>
Bookmarks