Hello, I recently created a function that works okay, but has a bad, cheap, hack. Here's it is:
function specialCode ($parse, $linkHTML = $linkHTML, $postlinkHTML = $postlinkHTML)
{
$regexp = '([[])';
$regexpPost = '([<br>|-|/|| |😐;|.|,|[|)|(])';
for ($c = 0; $c < 5; $c++) {
$parse = eregi_replace ("\[b\]$regexp\[/b\]", "<b>\\1</b>", $parse);
$parse = eregi_replace ("\[i\]$regexp\[/i\]", "<i>\\1</i>", $parse);
$parse = eregi_replace ("\[quote\]$regexp\[/quote\]", $quoteHTML, $parse);
$parse = eregi_replace ("\[link\]($regexp)\[/link\]", $linkHTML, $parse);
$parse = eregi_replace ("\[link="$regexp"\]$regexp\[/link\]", $linkHTML, $parse);
$parse = eregi_replace ("Post \#$regexpPost", $postlinkHTML, $parse);
}
return $parse;
}
In order to get 'global' searching I've used a for loop. This is a bad hack, I'm ashamed. Can someone please fix up my regular expressions. I don't want it to just replace all 's than all 's. I don't want users screwing up the page, if they know they can, they will.
Btw, I'm trying to do UBB style code. I'm not using mySql.