Hi! I have a peice of code that looks like this:
$txt = preg_replace("/(?<!<a href=\")((http|ftp)+(s)?:\/\/[<>\s]+)/i", "<a href=\"\0\">\0</a>", $txt );
I got it from a comment on www.php.net/preg_replace and it turns a URL into a link. The problem is, it doesn't always understand when the link ends. If there is a paranthesis efter the link, or a period, it will include this in the link.
I havn't found any answers on google, I've read both forum posts and documentation.
Any solutions, questions or sugestions are welcome.