TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   General (http://www.talkphp.com/general/)
-   -   Please help with easy preg_replace problem (http://www.talkphp.com/general/3467-please-help-easy-preg_replace-problem.html)

oscargodson 10-10-2008 04:28 AM

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.


All times are GMT. The time now is 09:07 AM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0