This is my first experiment with preg_replace and I want to know if this will give me the desired effect if...PHP Code:// Parse all blogCode used in this comment/blog
// $contents = preg_replace("/\\[b\\](.?*)\\[\\/b]\\]/is","<b>$1</b>",$contents);
function ParseCode($text = "Invalid use of Function",$abCode = 1) {
if ($abCode) {
$query = mysql_query("select * from abCode");
for ($i = 0; $i < mysql_numrows($query); $i++) {
$abOpenTag = mysql_result($query,$i,"abOpenTag");
$abCloseTag = mysql_result($query,$i,"abCloseTag");
$htmlOpenTag = mysql_result($query,$i,"htmlOpenTag");
$htmlCloseTag = mysql_result($query,$i,"htmlCloseTag");
$text = preg_replace("/".addslashes($abOpenTag)."(.?*)".addslahses($abCloseTag)."/is","$htmlOpenTag$1$htmlCloseTag",$text);
}
return $text;
}
}
$abOpenTag has the value of "[ b ]" (without the spaces inbetween)
$abCloseTag has the value of "[ /b ]" (without the spaces inbetween)
$htmlOpenTag has the value of "<b>"
$htmlCloseTag has the value of "</b>"
Will that work, or do I need to change a few things? I tried installing IIS yesterday but had all kinds on my laptop (i think its too slow) but if anyone could help me here, I would appreciate it.




) but if anyone could help me here, I would appreciate it.
Reply With Quote