tweak URL regex
authorDaniel Albers <daniel@lbers.com>
Sun, 31 Jan 2010 14:34:39 +0000 (15:34 +0100)
committerManuel Nickschas <sputnick@quassel-irc.org>
Sun, 31 Jan 2010 19:26:05 +0000 (20:26 +0100)
We still allow some of the characters flagged "unwise" in RFC 2396
Fixes #860
Fixes #876

src/uisupport/clickable.cpp

index df2d3dc..e875bad 100644 (file)
@@ -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+\\.))");
 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[] = {
   static QString urlEnd("(?:>|[,.;:\"]*\\s|\\b|$)");
 
   static QRegExp regExp[] = {