preg_replace problem
Posted: Fri Jun 03, 2005 11:27 pm
i'd like to have:
to replace URLs that are typed in
and
so that they can have the link appear as text...
however, when the 2nd function is used, the URL that is submitted gets replaced by the first function. not sure if i explained that right, but i hope you will figure it out.
so, what do i need to do in order to use both without any conflicts? I promise I tried to figure it out myself before running here
thanks for any help.
Code: Select all
$body = preg_replace("`((http)+(s)?:(//)|(www\.))((\w|\.|\-|_)+)(/)?(\S+)?`i", "<a href=\"http$3://$5$6$8$9\" target=\"blank\" title=\"$0\">$5$6</a>", $body);and
Code: Select all
$body = preg_replace("|\[link=[\"\']?(.+?)[\"\']?\](.+?)\[/link\]|i", "<a href=\"http://www.$1\" target=\"blank\">$2</a>", $body);however, when the 2nd function is used, the URL that is submitted gets replaced by the first function. not sure if i explained that right, but i hope you will figure it out.
so, what do i need to do in order to use both without any conflicts? I promise I tried to figure it out myself before running here
thanks for any help.