I have this example.
$link='http://www.mylink.com';
$string= 'You have confirmed your account. <br /> Please click {here} to log in';
echo preg_replace('/(\[(.+)\])/', '<a href="' . $link . '">$2</a>', $string);
and the output is:
You have confirmed your account. Please click {here} to log in
What is the problem?