MiKeY MiKeY - 9 months ago 74
PHP Question

preg_replace(): Unknown modifier '\\'

This is likely the simplest issue ever. But I did not write the code and its not commented. I am just trying to fix it because its causing a lot of issues on my site. Its in the main text parser code.

Error: preg_replace(): Unknown modifier '\'
More Complete error: PHP Warning: preg_replace(): Unknown modifier '\' in .../cutout/text/parser.php on line 1192, referer: domain/forums/

Code: http://pastebin.com/k98mpF8n
There is a lot of it so this is the simplest way to do it. $text is the parameter. Looks like its a bad word filter but seems to be missing with lots of things. I can't find out what is being passed sorry. Unless you know of a why that I could.

$text = preg_replace( '/(^|\W)' . preg_quote( $test ) . '(\W|$)/i', "\\1" . $replace . "\\2", $text );

I am sure I am just missing it.

Any help is greatly appreciated. Thanks

preg_quote( $test )

should be

preg_quote( $test, '/' );