Jump to content

Preg Match


ambo

Recommended Posts

Warning: preg_replace(): Compilation failed: unmatched parentheses at offset 2 in /home/content/d/e/c/decuralogin/html/view_topic.php on line 184?????

it was working then stoped

<?PHP
include("include/session.php");
$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\]/",
"/\:\)/",
"/\:\(/",
"/\:O/",
"/\:P/",
"/\;)/",
"/\:-E:/",
"/\:!:/",
"/\:?:/",
"/\:W:/",
"/\:nin:/");

$replacements = array(
"<a href=\"\\1\">\\1</a>",
"<img border=0 src='\\1'>",
"<b>\\1</b>",
"<b>\\1</b>",
"<u>\\1</u>",
"<u>\\1</u>",
"<i>\\1</i>", 
"<i>\\1</i>", 
"<br><div align=\"center\"><div align=\"left\" style='line-height: 12px; width: 75%; white-space: nowrap; background:#242424; overflow: auto; max-height: 25em;'><b>Quote:</b><br><br><i>\\1</i></div>", 
"<br><div align=\"center\"><div align=\"left\" style='line-height: 12px; width: 75%; white-space: nowrap; background:#242424; overflow: auto; max-height: 25em;'><b>Quote:</b><br><br><i>\\1</i></div>",
"<b>Code:</b><br><div style='line-height: 12px; width: 99%; white-space: nowrap; overflow: auto; max-height: 25em;'>\\1</div>",
"<b>Code:</b><br><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 />", 
"<img src=\"bbeditor/images/smilies/yellow/smile.gif\" border=\"0\">",
"<img src=\"bbeditor/images/smilies/yellow/sad.gif\" border=\"0\">",
"<img src=\"bbeditor/images/smilies/yellow/woot.gif\" border=\"0\">",
"<img src=\"bbeditor/images/smilies/yellow/razz.gif\" border=\"0\">",
"<img src=\"bbeditor/images/smilies/yellow/wink.gif\" border=\"0\">",
"<img src=\"bbeditor/images/smilies/yellow/finger.gif\" border=\"0\">",
"<img src=\"bbeditor/images/smilies/yellow/exc.gif\" border=\"0\">",
"<img src=\"bbeditor/images/smilies/yellow/question.gif\" border=\"0\">",
"<img src=\"bbeditor/images/smilies/yellow/rock.gif\" border=\"0\">",
"<img src=\"bbeditor/images/smilies/yellow/nin.gif\" border=\"0\">");
?>

<?php
$message = $rows['detail'];



$post = preg_replace($patterns,$replacements,$message);

print $post;
?>

 <?php
$answer = $rows['a_answer'];

$posta = preg_replace($patterns,$replacements, $answer);

print $posta;
?>
                

Link to comment
https://forums.phpfreaks.com/topic/146915-preg-match/
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.