diff --git a/src/texthandler.cpp b/src/texthandler.cpp index 5b45966b8..3c45545a9 100644 --- a/src/texthandler.cpp +++ b/src/texthandler.cpp @@ -626,7 +626,7 @@ QString TextHandler::linkifyUrls(QString stringIn) int skip = 0; if (match.captured(0).size() > 0) { if (stringIn.left(index).count(QStringLiteral("")) == stringIn.left(index).count(QStringLiteral(""))) { - auto replacement = QStringLiteral("%1").arg(match.captured(2)); + auto replacement = QStringLiteral("%1").arg(match.captured(1)); stringIn = stringIn.replace(index, match.captured(0).size(), replacement); } else { skip = match.captured().length(); diff --git a/src/utils.h b/src/utils.h index d07007e71..3447310eb 100644 --- a/src/utils.h +++ b/src/utils.h @@ -80,6 +80,6 @@ static const QRegularExpression QRegularExpression::CaseInsensitiveOption | QRegularExpression::UseUnicodePropertiesOption); static const QRegularExpression emailAddress(QStringLiteral(R"((*SKIP)(*F)|\b(mailto:)?((\w|\.|-)+@(\w|\.|-)+\.\w+\b))"), QRegularExpression::CaseInsensitiveOption | QRegularExpression::UseUnicodePropertiesOption); -static const QRegularExpression mxId(QStringLiteral(R"((^|[][[:space:](){}`'";])([!#@][-a-z0-9_=#/.]{1,252}:\w(?:\w|\.|-)*\.\w+(?::\d{1,5})?))"), +static const QRegularExpression mxId(QStringLiteral(R"((?<=^|[][[:space:](){}`'";])([!#@][-a-z0-9_=#/.]{1,252}:\w(?:\w|\.|-)*\.\w+(?::\d{1,5})?))"), QRegularExpression::CaseInsensitiveOption | QRegularExpression::UseUnicodePropertiesOption); }