\\1', $text); $text = eregi_replace('([[:space:]()[{}])(www.[-a-zA-Z0-9@:%_\+.~#?&//=]+)', '\\1\\2', $text); $text = eregi_replace('([_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,3})', '\\1', $text); return $text; } // Usage // Email address example $text = "me@svnlabs.com"; echo URL2Link($text); echo "

"; // URL example $text = "http://www.svnlabs.com"; echo URL2Link($text); echo "

"; // FTP URL example $text = "ftp://ftp.svnlabs.com"; echo URL2Link($text); ?>