How about this:
function stripbbtags ($string) {
$pattern = "#\[([^\]]+?)(=[^\]]+?)?\](.+?)\[/\1\]#";
$replace = "";
return preg_replace($pattern, $replace, $string);
}
The error message is a bit cryptic but actually give you some insight, if take a look at the documentation of preg_replace, you would notice they talk about modifiers. Those modifiers are used to pass options to the PCRE library, i.e. do some case insensitive match, string is in unicode etc.
The problem relies in the character you are using as separator; you are using / and the regular expression contain a slash so PCRE thinks \1\]/ is your modifier. Changing the separator to # fixes the problem.
[quote]tags to be nested.) If so, your solution will need to be a bit more complex. The one you have now will not work correctly with nested tags.