Forum Moderators: coopster
PHP & MySQL:
How can I recognize a url, and turn it into a HTML hyperlinked url.
without, having like [url]http://www.example.com[/url]
I got the above to work, but can I get it to recongize without the [url][/url]and have it convert the url to a hyperlinked url?
Thanks for the help, I appreciate you guys help all the time, thank you!
Warmly,
Wesley
$pattern = "/http:\/\/(www\.)?([^.]+\.[^.\s]+\.?[^.\s]*)/i";
$replace = "<a href='http://\\1\\2'>http://\\1\\2</a>";
$string = [url=http://us2.php.net/preg-replace]preg_replace[/url]($pattern,$replace,$string);
echo $string;
Where
$string is the text. Just a couple notes about this pattern: I know this is missing a possibility but I figured I'd get you on the right track ;)
Good luck!