I've got a small problem here in replacing html for bb. I can go bb to html really easily (see the code below), but when I go the other way, I get the same text returned as when I put it in

if ($tobb == 0)
        $search = array('/\[bold\](.*?)\[\/bold\]/is','/\[italic\](.*?)\[\/italic\]/is',

        $replace = array('<strong>$1</strong>','<em>$1</em>','<u>$1</u>',
                		 '<a href="$1">$1</a>','<a href="$1">$2</a>');
        $replace = array('\[bold\](.*?)\[\bold\]','\[italic\](.*?)\[\italic\]',

        $search = array('/\<strong\>$1\<\/strong\>/is','/\<em\>$1\<\/em\>/is','/\<u\>$1\<\/u\>/is',
                		'/\<a href="$1"\>$1\<\/a\>/is','/\<a href="$1"\>$2\<\/a\>/is');
	$newtext = preg_replace($search, $replace, $text);

I'm using the following to test the code (in another file)

$m = "[bold]Hello there[/bold] [italic]my wibblers hurt[/italic] [underline]I love becki[/underline] [link=www.bbc.co.uk/drwho]http://www.bbc.co.uk/drwho[/link]";
$n = convert($m, 0);
echo $n;
$b = convert($n, 1);
echo $b;

I have a feeling that my regex is broken, but can't see where. Help!