Then the first thing you should do is turn it into just a URL.
Assuming your original regular expression is what you want, do this:
$data = ereg_replace("(([.<>[:space:]]+.)|([[:alpha:]]+://))+". "[.<>[:space:]]+.[<>[:space:]]+", "\0", $data);
followed by the code I posted.
You might be able to do it all as a single ereg_replace, but that is rather complex and (as you have discovered) may be inflexible. As a general rule, code ends up being more maintainable when you break it down into simple steps.