diff --git a/src/misc.cpp b/src/misc.cpp
index 3f2fa27aa..1504d89db 100644
--- a/src/misc.cpp
+++ b/src/misc.cpp
@@ -505,7 +505,8 @@ bool misc::isUrl(const QString &s)
QString misc::parseHtmlLinks(const QString &raw_text)
{
QString result = raw_text;
- QRegExp reURL("(\\s|^)" //start with whitespace or beginning of line
+ static QRegExp reURL(
+ "(\\s|^)" //start with whitespace or beginning of line
"("
"(" //case 1 -- URL with scheme
"(http(s?))\\://" //start with scheme
@@ -556,7 +557,7 @@ QString misc::parseHtmlLinks(const QString &raw_text)
result.replace(reURL, "\\1\\2");
// Capture links without scheme
- QRegExp reNoScheme("");
+ static QRegExp reNoScheme("");
result.replace(reNoScheme, "");
return result;