John Gruber's regex for matching URLs

This pattern attempts to be practical. It makes no attempt to parse URLs according to any official specification. It isn’t limited to predefined URL protocols. It should be clever about things like parentheses and trailing punctuation.

URLs are notoriously difficult to match with regular expressions. This seems to be a pretty accurate implementation, I’ve yet to have it fail.