cobusbo Posted September 19, 2015 Share Posted September 19, 2015 Hi I'm currently having a syntex error with my bad words filter function function filterBadWords($str) { $result1 = mysql_query("SELECT word FROM StringyChat_WordBan") or die(mysql_error()); $replacements = "x"; while($row = mysql_fetch_assoc($result1)) { $str = preg_replace('/\b' . $row['word'].'\b/ie', ':-x', $str); } return $str; } Parse error: syntax error, unexpected ':' in /home/u342037492/public_html/chat2/page.php(1917) : regexp code on line 1 Fatal error: preg_replace(): Failed evaluating code: :-x in /home/u342037492/public_html/chat2/page.php on line 1917 I know its the :-x part causing the problem but how can I fix it? and is there maybe a better way to do the filter because if I got the word "ass" in my list it will replace assassinate to :-x :-xinate ? Quote Link to comment Share on other sites More sharing options...
Solution Ch0cu3r Posted September 19, 2015 Solution Share Posted September 19, 2015 Remove the e pattern modifier. Quote Link to comment 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.