[SOLVED]Small quote problem
Posted: Thu Jun 02, 2005 1:18 pm
Having a small regex problem, and im not sure why it happens. As you can see, I am using the $2 twice (Not sure if thats why its happening), the first time it outputs fine, however, the second time it comes up with a double quote at the end, is anyone familiar with this problem, or knows how to fix it?
Thanks.
Ouputs: <a href="dsfdsf" target="_blank">dsfdsf"</a>
Edit: solved
Thanks.
Code: Select all
$string = '[img="dsfdsf"]';
preg_replace("/\[img=(\")?(.*)(\")?\]/i", "<a href=\"$2\" target=\"_blank\">$2</a>", $string);Edit: solved