Closed ferki closed 10 years ago
I merged this because it fixes the two issues from #204, although I'm not sure how big of an improvement it really is.
For example, the new pattern allows single-letter domain endings, which is not supported by DNS. Also, while http://example.com/-/test/
is properly highlighted now, http://example.com/-/
is not.
But since URL matching is not an exact science anyway, the result is probably good enough.
Thank you for the fix!
Well, I chose this pattern as it is just slightly more complex than the previous one while fixes the two issues already reported by users, and - on a subjective note - I found it working well for both private and professional everyday use in the past several months. So, as you mentioned, it is probably good enough ;)
The pattern suggested by @jolivares on #204 (thanks for the valuable resource!) properly handles single-letter domain endings, but it is lot more complex, still fails with http://example.com/-/
and it admittedly doesn't want to try to match URLs like http://localhost/
(which would be useful in a terminal, IMHO).
All in all, the topic seems to be highly subjective, so I guess what matters most is how exactly we define that 'good enough' :)
ps.: apropos of scientific approach, the Regular Expression URI Validation article by Jeff Roberson might be also a good read for anyone who is more interested in the depths of this topic.
This fine pattern is originally from Bert Münnich's url-select extension for the rxvt-unicode terminal emulator, from his urxvt-perls project.
This fixes both the port number highlighting and the '
-
as URL path element' issues reported on #204 (and possibly other similar cases).