08-14-2008, 02:35 PM
|
#2 (permalink)
|
|
The Gregarious
Join Date: Mar 2008
Location: Cana'derr
Posts: 653
Thanks: 24
|
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
|
|
|
|