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. Link to comment https://forums.phpfreaks.com/topic/287681-warning-preg_replace-unknown-modifier/ Share on other sites More sharing options...
requinix Posted April 10, 2014 Share Posted April 10, 2014 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$])#" 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
Archived
This topic is now archived and is closed to further replies.