Possible Duplicates:
Recursive BBCode Parsing
Strip BBCode via RegEx
What is the best way to remove all BBCode tags of a string and their content in PHP?
Possible Duplicates:
Recursive BBCode Parsing
Strip BBCode via RegEx
What is the best way to remove all BBCode tags of a string and their content in PHP?
<?php
function stripBBCode($text_to_search) {
$pattern = '|[[\/\!]*?[^\[\]]*?]|si';
$replace = '';
return preg_replace($pattern, $replace, $text_to_search);
}
echo stripBBCode($text_to_search);
?>
demo