View Single Post
Old 08-14-2008, 01:35 PM   #2 (permalink)
delayedinsanity
is cute and cuddly
 
delayedinsanity's Avatar
 
Join Date: Mar 2008
Location: Vegas, Baby
Posts: 963
Thanks: 31
delayedinsanity is on a distinguished road
Default

PHP Code:
$this->_string preg_replace('~((https?|ftp)\://[a-z0-9+_-]+(\.[a-z0-9+_-]+)*(/([a-z0-9+_-]\.?)+)*/?(\?[a-z+&_.-][a-z0-9;:@/&%=+$_.-]*)?(#[a-z_.-][a-z0-9+_.-]*)?)~is''<a href="$1">$1</a>'$this->_string); 
Has been working for me... doesn't parse the URLs title like vBulletins parser, but I still think it's a good start. Looks for web or ftp protocols, handles top level and sub-domains with ease, with any number of sub-directories, a query string, or an anchor.
-m
delayedinsanity is offline  
Reply With Quote