Tu as deux choix :

$text = preg_replace("/\[arg=(\#[0-9A-F]{6}|[a-z]+)\]/sie", 'func(\'$1\')', $text);
ou bien

function callback_func($m)
{
return (func($m[1]));
}
$text =...