$pattern = "@\b(https?://)?(([0-9a-zA-Z_!~*'().&=+$%-]+:)?[0-9a-zA-Z_!~*'().&=+$%-]+\@)?(([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-zA-Z_!~*'()-]+\.)*([0-9a-zA-Z][0-9a-zA-Z-]{0,61})?[0-9a-zA-Z]\.[a-zA-Z]{2,6})(:[0-9]{1,4})?((/[0-9a-zA-Z_!~*'().;?:\@&=+$,%#-]+)*/?)@"; $text_with_hyperlink = preg_replace($pattern, '<a href="\0">\0</a>', $text_with_raw_URLs);
Never been to CodeSnippets before?
Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)
convert URLS to links in PHP (See related posts)
Comments on this post
You need to create an account or log in to post comments to this site.
Related Posts
» Using this function you will... in apache php mysql find ruby rails time date perl regex shell http osx mac css python google html bash error windows sql activerecord javascript java rubyonrails unix linux database c text csharp XSLT image string xml file array web url math mongrel_cluster hash convert dscl C++ sips series60 rexml REBOL jonas jsfromhell raoni sinatra rscript
» Statement Emulation in apache php mysql find ruby rails time date perl regex shell http osx mac css python google html bash error windows sql activerecord javascript java rubyonrails unix linux database c text csharp XSLT image string xml file array web url math mongrel_cluster hash convert dscl C++ sips series60 rexml REBOL jonas jsfromhell raoni sinatra rscript
» Fill data into an XML templa... in apache php mysql find ruby rails time date perl regex shell http osx mac css python google html bash error windows sql activerecord javascript java rubyonrails unix linux database c text csharp XSLT image string xml file array web url math mongrel_cluster hash convert dscl C++ sips series60 rexml REBOL jonas jsfromhell raoni sinatra rscript
» Wrap all methods (functions)... in apache php mysql find ruby rails time date perl regex shell http osx mac css python google html bash error windows sql activerecord javascript java rubyonrails unix linux database c text csharp XSLT image string xml file array web url math mongrel_cluster hash convert dscl C++ sips series60 rexml REBOL jonas jsfromhell raoni sinatra rscript
» Swap windows between two wor... in apache php mysql find ruby rails time date perl regex shell http osx mac css python google html bash error windows sql activerecord javascript java rubyonrails unix linux database c text csharp XSLT image string xml file array web url math mongrel_cluster hash convert dscl C++ sips series60 rexml REBOL jonas jsfromhell raoni sinatra rscript
» Anchor a footer to the botto... in apache php mysql find ruby rails time date perl regex shell osx css python input html bash windows sql javascript java rubyonrails unix linux database textmate c XSLT image string xml swing copy array onload tags web url io download imagemagick utf8 dos hash convert batch C++ jpeg delicious series60
Snippets (source code soon to be available) developed by Peter Cooper and powered by Ruby On Rails
www.advesgroup.com
www.advesreklam.com
sevismesahnesi.tk
seksseyret.com