Here's a great long regex for matching URLs:
(?i)\b((?:(?:[a-z][\w-]+:)?(?:/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»""‘’]))
An extended version of this (to make it clear):
(?xi)
\b
(
(?:
(?:[a-z][\w-]+:)?
(?:
/{1,3}
|
[a-z0-9%]
)
|
www\d{0,3}[.]
|
[a-z0-9.\-]+[.][a-z]{2,4}/
)
(?:
[^\s()<>]+
|
\(([^\s()<>]+|(\([^\s()<>]+\)))*\)
)+
(?:
\(([^\s()<>]+|(\([^\s()<>]+\)))*\)
|
[^\s`!()\[\]{};:'".,<>?«»""‘’] # not a space or one of these punct chars
)
)
, , - , , , , -, .