Welcome Guest, Not a member yet? Register   Sign In
Need regex help to replace links in a string
#2

[eluser]Dyllon[/eluser]
Code:
$string = "http://codeigniter.com";

echo preg_replace('@(https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?)@', '<a href="$1">$1</a>', $string);


Messages In This Thread
Need regex help to replace links in a string - by El Forum - 01-11-2010, 11:32 AM
Need regex help to replace links in a string - by El Forum - 01-11-2010, 11:45 AM
Need regex help to replace links in a string - by El Forum - 01-11-2010, 11:47 AM
Need regex help to replace links in a string - by El Forum - 01-11-2010, 11:55 AM
Need regex help to replace links in a string - by El Forum - 01-11-2010, 12:01 PM
Need regex help to replace links in a string - by El Forum - 01-11-2010, 02:53 PM



Theme © iAndrew 2016 - Forum software by © MyBB