Convert text links to actual HTML links

This one liner will search a string and replace all links found in the text to a real html link.

$string = preg_replace("/(?:(http:\/\/)|(www\.))(\S+\b\/?)([ [:punct:]]*)(\s|$)/i","<a href=\"http://$2$3\">$1$2$3</a>$4$5", $string);

Page Comments (Click to edit)

Design by N.Design Studio, adapted by solidGone.org (version 1.0.0)
Powered by pmwiki-2.2.0-beta65