sindresorhus / linkify-urls

Linkify URLs in a string
MIT License
160 stars 22 forks source link

More functional regex for URL parsing #8

Closed LeoColomb closed 6 years ago

LeoColomb commented 6 years ago

This PR is more for a discussion about URL parsing than a direct PR. Just found that a lot of URLs has been excluded with the actual regex, then I tried to find something better.

My proposal is based on Stephen Hay work as seen on https://mathiasbynens.be/demo/url-regex. Still excluding parentheses, so links like https://en.wikipedia.org/wiki/Kansas_(disambiguation) are not well parsed.

🚀

sindresorhus commented 6 years ago

The parens issue is exactly why we're using a simpler regex: https://github.com/sindresorhus/linkify-urls/commit/aca71b8855c0b13286308119e427184b8158cbed

LeoColomb commented 6 years ago

Oh, good to know! That said the "simple" regex is very complicated, isn't it? 😇

sindresorhus commented 6 years ago

I think this would be a better solution: https://github.com/kevva/url-regex/pull/35#issuecomment-331970744

LeoColomb commented 6 years ago

Great! Then closing in favor of #9 😺