Jump to content

BB Code Error?


RaythMistwalker

Recommended Posts

      $bbreplace = array (
          '/(\[[bb]\])(.+)(\[\/[bb]\])/',
          '/(\[[ii]\])(.+)(\[\/[ii]\])/',
          '/(\[[uu]\])(.+)(\[\/[uu]\])/',
          '/(\[[ss]\])(.+)(\[\/[ss]\])/',
          '/(\[url=http://)(.+)(\])(.+)(\[\/url\])/',
          '/(\[img\])(.+)(\[\/img\])/',
          '/(\[img\])(.+)(\[\/IMG\])/',
          '/(\[color=)(.+)(\])(.+)(\[\/COLOR\])/',
          '/(\[color=)(.+)(\])(.+)(\[\/color\])/',
          '/(\[size=)(.+)(\])(.+)(\[\/SIZE\])/',
          '/(\[size=)(.+)(\])(.+)(\[\/size\])/',
          '/(\[list\](.+)(\[\/list\])/',
          '/(\[list=1\](.+)(\[\/list\])/',
          '/(\[lLIST\](.+)(\[\/LIST\])/',
          '/(\[list=1\](.+)(\[\/LIST\])/',
          '/(\[*\](.+)/'
          );
      $bbreplacements = array (
          '<b>\\2</b>',
          '<i>\\2</i>',
          '<u>\\2</u>',
          '<s>\\2</s>',
          '<a href="\\2">\\4</a>',
          '<img src="\\2">',
          '<img src="\\2">',
          '<font color="\\2">\\4</font>',
          '<font color="\\2">\\4</font>',
          '<font size="\\2">\\4</font>',
          '<font size="\\2">\\4</font>',
          '<ul>\\2</ul>',
          '<ol>\\2</ol>',
          '<ul>\\2</ul>',
          '<ol>\\2</ol>',
          '<li>\\2</li>'
          );
      $PostText = preg_replace($bbreplace, $bbreplacements, $PostText);

 

This is what I have to do BB Codes so Far. Now when I go to view the thread I get:

Warning: preg_replace() [function.preg-replace]: Compilation failed: missing ) at offset 25 in /home/rayth/public_html/forum/viewthread.php on line 95

 

Line 95:

$PostText = preg_replace($bbreplace, $bbreplacements, $PostText);

 

From testing I didn't get this error untill I added the

  • tags

Link to comment
https://forums.phpfreaks.com/topic/250198-bb-code-error/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.