blueman378 Posted March 19, 2008 Share Posted March 19, 2008 <?php //bbcode $patterns = array( "/\[url\](.*?)\[\/url\]/", "/\[img\](.*?)\[\/img\]/", "/\[b\](.*?)\[\/B\]/", "/\[b\](.*?)\[\/b\]/", "/\[u\](.*?)\[\/U\]/", "/\[u\](.*?)\[\/u\]/", "/\[i\](.*?)\[\/I\]/", "/\[i\](.*?)\[\/i\]/", "/\[quote\](.*?)\[\/quote\]/", "/\[quote\](.*?)\[\/QUOTE\]/", "/\[code\](.*?)\[\/code\]/", "/\[code\](.*?)\[\/CODE\]/", "/\[s\](.*?)\[\/s\]/", "/\[s\](.*?)\[\/S\]/", "/\[url=(.*?)\](.*?)\[\/url\]/", "/\[color=(.*?)\](.*?)\[\/color\]/", "/\[size=(.*?)\](.*?)\[\/size\]/", "/\[marquee\](.*?)\[\/marquee\]/", "/\[br\]/", //emoticons "/\:\)/", "/\:\(/", "/\:O/", "/\:P/", "/\:\|/", "/\:D/", "/\:\?/", "/\;)/"); $replacements = array( //bbcode "<a href=\"\\1\">\\1</a>", "<a href='\\1'><img border=0 src='\\1' height='100px' width='250px'></a>", "<b>\\1</b>", "<b>\\1</b>", "<u>\\1</u>", "<u>\\1</u>", "<i>\\1</i>", "<i>\\1</i>", "<div><b>Quote:</b> <i>\\1</i></div>", "<div><b>Quote:</b> \\1</div>", "<b>Code:</b><div style='line-height: 12px; width: 99%; white-space: nowrap; overflow: auto; max-height: 25em;'>\\1</div>", "<b>Code:</b><div style='line-height: 12px; width: 99%; white-space: nowrap; overflow: auto; max-height: 25em;'>\\1</div>", "<s>\\1</s>", "<s>\\1</s>", "<a href=\"\\1\" target=\"_blank\">\\2</a>", "<font color=\"\\1\">\\2</font>", "<font size=\"\\1\">\\2</font>", "<marquee>\\1</marquee>", "<br />", //emoticons "<img src=\"smilies/happy.gif\" border=\"0\">", "<img src=\"smilies/angry.gif\" border=\"0\">", "<img src=\"smilies/omg.gif\" border=\"0\">", "<img src=\"smilies/tounge.gif\" border=\"0\">", "<img src=\"smilies/dry.gif\" border=\"0\">", "<img src=\"smilies/biggrin.gif\" border=\"0\">", "<img src=\"smilies/confused.gif\" border=\"0\">", "<img src=\"smilies/wink.gif\" border=\"0\">" ); ?> well theres the coee, and heres the errors: Warning: preg_replace() [function.preg-replace]: Compilation failed: unmatched parentheses at offset 2 in /home/webspiri/public_html/test/webspirited/forum/view_topic.php on line 20 heres line 20, $q= $rows['detail']; $q = preg_replace($patterns,$replacements, $q); cheers Quote Link to comment https://forums.phpfreaks.com/topic/96857-preg_replace-functionpreg-replace-compilation-failed-unmatched-parenthese/ Share on other sites More sharing options...
blueman378 Posted March 19, 2008 Author Share Posted March 19, 2008 fixed it, "/\;)/"); Quote Link to comment https://forums.phpfreaks.com/topic/96857-preg_replace-functionpreg-replace-compilation-failed-unmatched-parenthese/#findComment-495681 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.