PHP BBCode

function remove_bbcode($string)
{
    $pattern = '|[[\/\!]*?[^\[\]]*?]|si';
    $replace = '';
    return preg_replace($pattern, $replace, $string);
}