New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Better clickable URL regexes #3112
Comments
Oh, and some websites require the closing |
Is there a way to not underline the surrounding punctuation in the first regex? I use a capture-group to capture |
Unfortunately it doesn't handle messages like:
It ends up making |
Essentially a duplicate of #928 |
What about a way to underline just the part that is captured? My first regex is |
If you don't need the punctuation to match or be underlined, can you omit the |
The purpose is to specifically match hyperlinks that are within punctuation. It is a simple (and therefore performant) way to match things like There are two regexes in my snippet in the first comment. The If a hyperlink doesn't match this first regex, the next regex gets tested, which has a I've been using these two regexes instead of the default regexes for the last 3 or 4 days, and it is much, much, much better for matching hyperlinks. 99.9% of the links are correctly clickable now whereas before only about 60% to 70% of the links would be clickable without needing to manually add a trailing I was hoping to share these with the community so they could try them out and iterate on them to improve them. They are much better than the defaults because not only do they match more hyperlinks more accurately but they're also simpler, and therefore more performant, than the defaults. There is just this one edge-case, as mentioned, that if resolved would make these regexes 100% perfect for me. |
Have you considered using a non-capturing group for the punctuation? |
... but the capture group isn't wrapped around the punctuation classes! |
Okay, I tried setting the regex to |
I'd like to move this conversation to #928 and to continue it there. I've condensed my multiple comments here into one heavily edited comment on that issue. |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
The default URL regexes leave a lot to be desired. URLs ending with
)
e.g. https://en.wikipedia.org/wiki/Class_(set_theory) will not include the trailing closing)
in the clicked result. Likewise for URLs ending with-
as in https://www.onlinegdb.com/fork/Jd2x8Yvh-. There also were quirky issues with URLs wrapped with parentheses or brackets or quotes.After a lot of tweaking and experimentation, I've settled on these two regexes for URLs:
I have used these two regexes for the last couple of days on busy IRC channels and they seem to work much, much better than the default regexes. I don't profess to be an expert with regexes and I appreciate any critical feedback/improvements/suggestions.
What does everyone think?
The text was updated successfully, but these errors were encountered: