Preg_Replace with Special Characters not working
Posted: Sat Feb 16, 2008 12:43 am
I cant get the preg_replace to match [#A] where a can be any letter, uppercase or lowercase to replace with <a name=""></a>
A community of PHP developers offering assistance, advice, discussion, and friendship.
http://forums.devnetwork.net/
Code: Select all
<?php
$str = "[#A]Bah blah blah ba[#B]";
echo preg_replace("/\[\#[(A-z)]\]/", '<a name="#$0"></a>', $str);
?>