PDA

View Full Version : strip_bbcode


squishi
10-30-2009, 01:10 PM
I have written a small plugin in the showthread_complete hook.

It works, except for the filtering of BBCODE.

strip_bbcode($vv);

I run this in the plugin, but the variable still contains BBCODE. :(

--------------- Added 1256912691 at 1256912691 ---------------

I found the solution on another site.
This works:

$pattern = '|[[\/\!]*?[^\[\]]*?]|si';
$replace = '';
$vv = preg_replace($pattern, $replace, $vv);


It turns out that this is the wrong function for me, though.
I need to remove the whole bbcode including the content between the brackets.
How do I do that?

Jaxel
10-30-2009, 01:57 PM
for the $pattern, I would use:
\[\w*\].*?\[\/\w*\]


Of just replace what you did with the second line:
$pattern = '|[[\/\!]*?[^\[\]]*?]|si';
$pattern = '|[[\/\!].*?[^\[\]]*?]|si';