terungwa Posted April 10, 2014 Share Posted April 10, 2014 $text = preg_replace("/([^[])/me([^\n\r$]*)([\n\r$])/", "\\1<span class=\"me\">*".$ubbObj->username." \\2 *</span>\\3", $text); $text = nl2br($text); $text = preg_replace("([^[])/me([^\n\r$]*)([\n\r$])", "\\1[me=".$this->username."]\\2[/me]\\3", $text); I was editing the code bit above (converting eregi_replace to preg_replace) but i am getting a warning: Warning: preg_replace(): Unknown modifier '(' could you help me resolve the right regex synthax. Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/287681-warning-preg_replace-unknown-modifier/ Share on other sites More sharing options...
Solution requinix Posted April 10, 2014 Solution Share Posted April 10, 2014 (edited) If you use / delimiters then you have to make sure you escape them inside the expression (or not even use them at all). ~ and # are common alternatives. "#([^[])/me([^\n\r$]*)([\n\r$])#" Edited April 10, 2014 by requinix Quote Link to comment https://forums.phpfreaks.com/topic/287681-warning-preg_replace-unknown-modifier/#findComment-1475717 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.