Skip to content

Improve link regex to fix handling paranthesis and question marks

Joshua Goins requested to merge work/redstrate/fix-wacky-links into master

I was super frustrated with links in NeoChat, stuff like the new Plasma bot to show VHI/RHI bugs would get absolutely decimated. Yes, the irony of not being able to check on bugs, because of a KDE matrix client bug isn't lost on me :-p

image

This patch fixes two key issues:

  • ? is considered part of the URL, even if there might not be anything past it. I've seen people now putting spaces after URLs to get around this issue.
  • ) is also part of the URL, as well as : despite those not being valid characters at the end of URLs.

I barely understood Regex before this, but was able to piece together something using conditional look-aheads.

Before

image

After

image

Edited by Joshua Goins

Merge request reports

Loading