View Single Post
Old 10-10-2008, 04:28 AM   #1 (permalink)
oscargodson
The Wanderer
 
Join Date: Jun 2008
Posts: 19
Thanks: 0
oscargodson is on a distinguished road
Default Please help with easy preg_replace problem

This should be easy, but I can't figure it out!

I want this to be replaced:
HTML Code:
[url="http://alink.com"]link text[/url]
with:
HTML Code:
<a href="http://alink.com">link text</a>
I currently have:
PHP Code:
$p preg_replace ("/\[url=\"(.*)\"\](.*)\[\/url\]/""<a href=\"$1\">$2</a>"$p); 
But this isn't going through ALL of the links, but just the first one... Any ideas? I'm supposed to put a + at the end but I can't get it to work.

Last edited by oscargodson : 10-10-2008 at 05:52 AM.
oscargodson is offline  
Reply With Quote