Hi all,
Im having some troubles getting a function I've written to return the correct information.
function strip_bb_code($str) {
$find = '/\[(.*)\](.*?)\[(.*)\]/is';
$replace = '$2';
return preg_replace($find, $replace, $str);
}
$string = '[test]test 1[/test] [yeah]yeah[/yeah]';
print strip_bb_code($string);
This function is supposed to strip any BB Brackets out of the string, and return only the text. For the example above, this should print "test1yeah".
It is only printing "yeah"
Where have I gone wrong?
Thanks for any help.