aboutsummaryrefslogtreecommitdiff
path: root/lib/util.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/util.cpp')
-rw-r--r--lib/util.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/util.cpp b/lib/util.cpp
index 875d7522..cf5e81a3 100644
--- a/lib/util.cpp
+++ b/lib/util.cpp
@@ -47,7 +47,7 @@ void Quotient::linkifyUrls(QString& htmlEscapedText)
// comma or dot
static const QRegularExpression FullUrlRegExp(
QStringLiteral(
- R"(\b((www\.(?!\.)(?!(\w|\.|-)+@)|(https?|ftp|magnet|matrix):(//)?)(&(?![lg]t;)|[^&\s<>'"])+(&(?![lg]t;)|[^&!,.\s<>'"\]):])))"),
+ R"(\b((www\.(?!\.)(?!(\w|\.|-)+@)|(https?|ftp):(//)?\w|(magnet|matrix):)(&(?![lg]t;)|[^&\s<>'"])+(&(?![lg]t;)|[^&!,.\s<>'"\]):])))"),
RegExpOptions);
// email address:
// [word chars, dots or dashes]@[word chars, dots or dashes].[word chars]
@@ -58,7 +58,7 @@ void Quotient::linkifyUrls(QString& htmlEscapedText)
// https://matrix.org/docs/spec/appendices.html#identifier-grammar
static const QRegularExpression MxIdRegExp(
QStringLiteral(
- R"((^|[^<>/])([!#@][-a-z0-9_=#/.]{1,252}:(?:\w|\.|-)+\.\w+(?::\d{1,5})?))"),
+ R"((^|[][[:space:](){}`'";])([!#@][-a-z0-9_=#/.]{1,252}:\w(?:\w|\.|-)*\.\w+(?::\d{1,5})?))"),
RegExpOptions);
Q_ASSERT(FullUrlRegExp.isValid() && EmailAddressRegExp.isValid()
&& MxIdRegExp.isValid());