Hacker News new | ask | show | jobs
by dmix 1722 days ago
@stephenhay seems to be the winner here if you don't need IP addresses (or weird dashed URLS). It's only 38 characters long and easy to understand.

    @^(https?|ftp)://[^\s/$.?#].[^\s]*$@iS
The simpler the better, if you're going to use something that is not ideal.
1 comments

Doesn’t cover mailto: which is fairly common. To be pedantic/strict, mailto: are URIs not URLs.