Use a better regex to identify URLs

This commit is contained in:
Konstantinos Sideris 2017-12-24 13:13:07 +02:00
parent 74ffef9826
commit 6835a97b15
4 changed files with 14 additions and 12 deletions

View file

@ -1,5 +1,8 @@
#pragma once
#include <QRegExp>
#include <QString>
// Non-theme app configuration. Layouts, fonts spacing etc.
//
// Font sizes are in pixels.
@ -16,6 +19,12 @@ namespace dialogs {
static constexpr int labelSize = 15;
}
namespace strings {
static const QString url_html = "<a href=\"\\1\">\\1</a>";
static const QRegExp url_regex(
"((www\\.(?!\\.)|[a-z][a-z0-9+.-]*://)[^\\s<>'\"]+[^!,\\.\\s<>'\"\\]\\)\\:])");
}
// Window geometry.
namespace window {
static constexpr int height = 600;

View file

@ -36,9 +36,6 @@ class Menu;
class OverlayModal;
class RoomSettings;
static const QString URL_HTML = "<a href=\"\\1\">\\1</a>";
static const QRegExp URL_REGEX("((?:https?|ftp)://\\S+)");
class TopRoomBar : public QWidget
{
Q_OBJECT