From 6b43b39928a36f8c7f497a7f9c2de0133e142bd8 Mon Sep 17 00:00:00 2001 From: Daniel Albers Date: Sun, 31 Jan 2010 15:34:39 +0100 Subject: [PATCH 1/1] tweak URL regex We still allow some of the characters flagged "unwise" in RFC 2396 Fixes #860 Fixes #876 --- src/uisupport/clickable.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/uisupport/clickable.cpp b/src/uisupport/clickable.cpp index df2d3dc4..e875bad1 100644 --- a/src/uisupport/clickable.cpp +++ b/src/uisupport/clickable.cpp @@ -51,8 +51,8 @@ void Clickable::activate(NetworkId networkId, const QString &text) const { ClickableList ClickableList::fromString(const QString &str) { // For matching URLs static QString scheme("(?:(?:mailto:|(?:[+.-]?\\w)+://)|www(?=\\.\\S+\\.))"); - static QString authority("(?:[,.;@:-]?\\w+)+(?::\\d+)?"); - static QString urlChars("(?:[,.;:\\w~@/?&=+$()!%#*{}\\[\\]'^-])"); + static QString authority("(?:[,.;@:]?[-\\w]+)+(?::\\d+)?"); + static QString urlChars("(?:[,.;:]*[\\w~@/?&=+$()!%#*{}\\[\\]\\|'^-])"); static QString urlEnd("(?:>|[,.;:\"]*\\s|\\b|$)"); static QRegExp regExp[] = { -- 2.20.1