php - Linking URL in middle of string -


wondering how detect url in string , return link. example

$text = 'go www.example.com example.com example.net http://example.com'; echo $text;

would return

go www.example.com example.com etc.

you use regex, or explode $text string on spaces , check substring each exploded word if begin http://, https:// or end in .com, .net, .org , wrap string in link


Comments

Popular posts from this blog

Perl - how to grep a block of text from a file -

delphi - How to remove all the grips on a coolbar if I have several coolbands? -

javascript - Animating array of divs; only the final element is modified -