Jump to content

preg_replace() [function.preg-replace]: Compilation failed: unmatched parenthese


blueman378

Recommended Posts

<?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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.