Ok, the URL matching and replacing regexps here don't work as well as they should. I tried fixing them last night but nothing I did seems to work right. The raw code is:
$value = preg_replace('/(http:\/\/[A-Za-z0-9_-]+(?:[.][A-Za-z0-9_-]+)+\S*)/xims', '<a href="$1">$1</a>', $value);
$value = preg_replace('/(?<!http:\/\/)(www[.][A-Za-z0-9_-]+(?:[.][A-Za-z0-9_-]+)+\S*)/xims', '<a href="http://$1">$1</a>', $value);
$value = preg_replace('/([A-Za-z0-9_.-]+@[A-Za-z0-9_-]+(?:[.][A-Za-z0-9_-]+)+)/xims', '<a href="mailto:$1">$1</a>', $value);
However, we still have the problem of:
aaahttp://www.example.com
Anytime I try and fix that, the regexp stops working entirely on what I want it to do.
The raw PERL-compatible regexps:
/(http:\/\/[A-Za-z0-9_-]+(?:[.][A-Za-z0-9_-]+)+\S*)/
/(?<!http:\/\/)(www[.][A-Za-z0-9_-]+(?:[.][A-Za-z0-9_-]+)+\S*)/
/([A-Za-z0-9_.-]+@[A-Za-z0-9_-]+(?:[.][A-Za-z0-9_-]+)+)/
In addition to just working like JOS, I'd like the URL matching to work a little better: I don't want them to match to a trailing period, comma, or trailing brackets or braces -- I didn't have much luck with that, either.
+100 bonus points for the best link-matching regexp.