diff --git a/src/xmlpatterns/data/qabstractdatetime_p.h b/src/xmlpatterns/data/qabstractdatetime_p.h
index 9c4b9d1a4dc1df24aaf2721b4423e6f5dc283120..6fc72c7508256263f77cafc58d952f9f2e17f8e8 100644
--- a/src/xmlpatterns/data/qabstractdatetime_p.h
+++ b/src/xmlpatterns/data/qabstractdatetime_p.h
@@ -140,7 +140,7 @@ namespace QPatternist
                 Q_ASSERT(exp.isValid());
             }
 
-            const QRegExp regExp;
+            QRegExp regExp;
             const qint8 zoneOffsetSign;
             const qint8 zoneOffsetHour;
             const qint8 zoneOffsetMinute;
diff --git a/src/xmlpatterns/data/qabstractduration_p.h b/src/xmlpatterns/data/qabstractduration_p.h
index 1667db57e6354f4ff080429189fe696e00a5c67d..a13d3f7da26c77b9425e12b59f8623ae78b7d350 100644
--- a/src/xmlpatterns/data/qabstractduration_p.h
+++ b/src/xmlpatterns/data/qabstractduration_p.h
@@ -116,7 +116,7 @@ namespace QPatternist
                 Q_ASSERT(yearP == -1 || yearP == 2);
             }
 
-            const QRegExp regExp;
+            QRegExp regExp;
             const qint8 year;
             const qint8 month;
             const qint8 day;
diff --git a/src/xmlpatterns/data/qderivedstring_p.h b/src/xmlpatterns/data/qderivedstring_p.h
index 87d9a2a50545646c9431b558cdad9c5c53552123..5f54f83506cb062e50a1a39b6be2fa3893f33930 100644
--- a/src/xmlpatterns/data/qderivedstring_p.h
+++ b/src/xmlpatterns/data/qderivedstring_p.h
@@ -262,7 +262,7 @@ namespace QPatternist
                 {
                     const QString simplified(lexical.trimmed());
 
-                    const QRegExp validate(QLatin1String("[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*"));
+                    QRegExp validate(QLatin1String("[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*"));
                     Q_ASSERT(validate.isValid());
 
                     if(validate.exactMatch(simplified))
diff --git a/src/xmlpatterns/functions/qpatternmatchingfns.cpp b/src/xmlpatterns/functions/qpatternmatchingfns.cpp
index 41ffe54057048204b013068e06971a2940e5d42e..27c7dd445dac7219912f41033686d3f596d4dc9a 100644
--- a/src/xmlpatterns/functions/qpatternmatchingfns.cpp
+++ b/src/xmlpatterns/functions/qpatternmatchingfns.cpp
@@ -59,7 +59,7 @@ MatchesFN::MatchesFN() : PatternPlatform(2)
 
 Item MatchesFN::evaluateSingleton(const DynamicContext::Ptr &context) const
 {
-    const QRegExp regexp(pattern(context));
+    QRegExp regexp(pattern(context));
     QString input;
 
     const Item arg(m_operands.first()->evaluateSingleton(context));
@@ -75,7 +75,7 @@ ReplaceFN::ReplaceFN() : PatternPlatform(3)
 
 Item ReplaceFN::evaluateSingleton(const DynamicContext::Ptr &context) const
 {
-    const QRegExp regexp(pattern(context));
+    QRegExp regexp(pattern(context));
     QString input;
 
     const Item arg(m_operands.first()->evaluateSingleton(context));
@@ -219,7 +219,7 @@ Item::Iterator::Ptr TokenizeFN::evaluateSequence(const DynamicContext::Ptr &cont
     if(input.isEmpty())
         return CommonValues::emptyIterator;
 
-    const QRegExp regExp(pattern(context));
+    QRegExp regExp(pattern(context));
     const QStringList result(input.split(regExp, QString::KeepEmptyParts));
 
     return makeItemMappingIterator<Item>(ConstPtr(this),
diff --git a/src/xmlpatterns/functions/qpatternplatform.cpp b/src/xmlpatterns/functions/qpatternplatform.cpp
index 08dc2f1fc245fb8e4cac0194de166e4b87a3af53..e9bbfbbbd49289fc73900e2022a30d6ab084f801 100644
--- a/src/xmlpatterns/functions/qpatternplatform.cpp
+++ b/src/xmlpatterns/functions/qpatternplatform.cpp
@@ -115,7 +115,7 @@ PatternPlatform::PatternPlatform(const qint8 flagsPosition) : m_compiledParts(No
 {
 }
 
-const QRegExp PatternPlatform::pattern(const DynamicContext::Ptr &context) const
+QRegExp PatternPlatform::pattern(const DynamicContext::Ptr &context) const
 {
     if(m_compiledParts == FlagsAndPattern) /* This is the most common case. */
     {
diff --git a/src/xmlpatterns/functions/qpatternplatform_p.h b/src/xmlpatterns/functions/qpatternplatform_p.h
index ede3c4e1db415223196628771ee6eb9c519a8ac7..4a7f0876368b5d82f8fa9f2e476ebf99b2ea6d89 100644
--- a/src/xmlpatterns/functions/qpatternplatform_p.h
+++ b/src/xmlpatterns/functions/qpatternplatform_p.h
@@ -113,7 +113,7 @@ namespace QPatternist
          * settings its flags, and everything else required for getting it ready to use. If an error
          * occurs, an appropriate error is raised via @p context.
          */
-        const QRegExp pattern(const DynamicContext::Ptr &context) const;
+        QRegExp pattern(const DynamicContext::Ptr &context) const;
 
         /**
          * @returns the number of captures, also called parenthesized sub-expressions, the pattern has.
diff --git a/src/xmlpatterns/parser/qquerytransformparser.cpp b/src/xmlpatterns/parser/qquerytransformparser.cpp
index 25821ca07ca678674b0ffea9cbf14292371e2463..781b89904cd51d3cb23ffc33e5d2aaa71561da5c 100644
--- a/src/xmlpatterns/parser/qquerytransformparser.cpp
+++ b/src/xmlpatterns/parser/qquerytransformparser.cpp
@@ -3735,7 +3735,7 @@ yyreduce:
 /* Line 1269 of yacc.c.  */
 #line 1412 "querytransformparser.ypp"
     {
-        const QRegExp encNameRegExp(QLatin1String("[A-Za-z][A-Za-z0-9._\\-]*"));
+        QRegExp encNameRegExp(QLatin1String("[A-Za-z][A-Za-z0-9._\\-]*"));
 
         if(!encNameRegExp.exactMatch((yyvsp[(2) - (2)].sval)))
         {
diff --git a/src/xmlpatterns/parser/querytransformparser.ypp b/src/xmlpatterns/parser/querytransformparser.ypp
index 1814f2852e77525d3fb41ba123f0e67a602fa5f8..d69868ea14666e5e8b1bccf78d03c6a33c328cac 100644
--- a/src/xmlpatterns/parser/querytransformparser.ypp
+++ b/src/xmlpatterns/parser/querytransformparser.ypp
@@ -1470,7 +1470,7 @@ VersionDecl: /* empty */
 Encoding: /* empty */                                                               /* [X] */
 | ENCODING StringLiteral
     {
-        const QRegExp encNameRegExp(QLatin1String("[A-Za-z][A-Za-z0-9._\\-]*"));
+        QRegExp encNameRegExp(QLatin1String("[A-Za-z][A-Za-z0-9._\\-]*"));
 
         if(!encNameRegExp.exactMatch($2))
         {
diff --git a/src/xmlpatterns/schema/qxsdschemachecker.cpp b/src/xmlpatterns/schema/qxsdschemachecker.cpp
index 0536fca3ac73500e8cf0eaeb47b90fe102cc612b..33e26791729ce905c74fa3d71cb0e22231d7d582 100644
--- a/src/xmlpatterns/schema/qxsdschemachecker.cpp
+++ b/src/xmlpatterns/schema/qxsdschemachecker.cpp
@@ -1124,7 +1124,7 @@ void XsdSchemaChecker::checkConstrainingFacets(const XsdFacet::Hash &facets, con
 
         for (int i = 0; i < multiValue.count(); ++i) {
             const DerivedString<TypeString>::Ptr value = multiValue.at(i);
-            const QRegExp exp = PatternPlatform::parsePattern(value->stringValue(), m_context, &reflection);
+            QRegExp exp = PatternPlatform::parsePattern(value->stringValue(), m_context, &reflection);
             if (!exp.isValid()) {
                 m_context->error(QtXmlPatterns::tr("%1 facet contains invalid regular expression").arg(formatKeyword("pattern.")), XsdSchemaContext::XSDError, sourceLocation(simpleType));
                 return;
diff --git a/src/xmlpatterns/schema/qxsdschemaparser.cpp b/src/xmlpatterns/schema/qxsdschemaparser.cpp
index a00b77ead03272583e2c65599d273a160b5e7790..292886e0a872d4c72d1ad8e255be949625f26287 100644
--- a/src/xmlpatterns/schema/qxsdschemaparser.cpp
+++ b/src/xmlpatterns/schema/qxsdschemaparser.cpp
@@ -511,7 +511,7 @@ void XsdSchemaParser::parseSchema(ParserType parserType)
     if (hasAttribute(CommonNamespaces::XML, QString::fromLatin1("lang"))) {
         const QString value = readAttribute(QString::fromLatin1("lang"), CommonNamespaces::XML);
 
-        const QRegExp exp(QString::fromLatin1("[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*"));
+        QRegExp exp(QString::fromLatin1("[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*"));
         if (!exp.exactMatch(value)) {
             attributeContentError("xml:lang", "schema", value);
             return;
@@ -1286,7 +1286,7 @@ XsdDocumentation::Ptr XsdSchemaParser::parseDocumentation()
     if (hasAttribute(CommonNamespaces::XML, QString::fromLatin1("lang"))) {
         const QString value = readAttribute(QString::fromLatin1("lang"), CommonNamespaces::XML);
 
-        const QRegExp exp(QString::fromLatin1("[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*"));
+        QRegExp exp(QString::fromLatin1("[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*"));
         if (!exp.exactMatch(value)) {
             attributeContentError("xml:lang", "documentation", value);
             return documentation;
diff --git a/src/xmlpatterns/schema/qxsdtypechecker.cpp b/src/xmlpatterns/schema/qxsdtypechecker.cpp
index e0ce55b88e3a4c96da1fda2d3c8293728062bc87..af098164dd1584e2c868ce71d08267c7b19fe3f6 100644
--- a/src/xmlpatterns/schema/qxsdtypechecker.cpp
+++ b/src/xmlpatterns/schema/qxsdtypechecker.cpp
@@ -452,7 +452,7 @@ bool XsdTypeChecker::checkConstrainingFacetsString(const QString &value, const X
         bool found = false;
         for (int j = 0; j < multiValue.count(); ++j) {
             const QString pattern = multiValue.at(j)->as<DerivedString<TypeString> >()->stringValue();
-            const QRegExp exp = PatternPlatform::parsePattern(pattern, m_context, m_reflection);
+            QRegExp exp = PatternPlatform::parsePattern(pattern, m_context, m_reflection);
             if (exp.exactMatch(value)) {
                 found = true;
                 break;
@@ -547,7 +547,7 @@ bool XsdTypeChecker::checkConstrainingFacetsSignedInteger(long long value, const
         bool found = false;
         for (int j = 0; j < multiValue.count(); ++j) {
             const QString pattern = multiValue.at(j)->as<DerivedString<TypeString> >()->stringValue();
-            const QRegExp exp = PatternPlatform::parsePattern(pattern, m_context, m_reflection);
+            QRegExp exp = PatternPlatform::parsePattern(pattern, m_context, m_reflection);
             if (exp.exactMatch(lexicalValue)) {
                 found = true;
                 break;
@@ -633,7 +633,7 @@ bool XsdTypeChecker::checkConstrainingFacetsUnsignedInteger(unsigned long long v
         bool found = false;
         for (int j = 0; j < multiValue.count(); ++j) {
             const QString pattern = multiValue.at(j)->as<DerivedString<TypeString> >()->stringValue();
-            const QRegExp exp = PatternPlatform::parsePattern(pattern, m_context, m_reflection);
+            QRegExp exp = PatternPlatform::parsePattern(pattern, m_context, m_reflection);
             if (exp.exactMatch(lexicalValue)) {
                 found = true;
                 break;
@@ -719,7 +719,7 @@ bool XsdTypeChecker::checkConstrainingFacetsDouble(double value, const QString &
         bool found = false;
         for (int j = 0; j < multiValue.count(); ++j) {
             const QString pattern = multiValue.at(j)->as<DerivedString<TypeString> >()->stringValue();
-            const QRegExp exp = PatternPlatform::parsePattern(pattern, m_context, m_reflection);
+            QRegExp exp = PatternPlatform::parsePattern(pattern, m_context, m_reflection);
             if (exp.exactMatch(lexicalValue)) {
                 found = true;
                 break;
@@ -820,7 +820,7 @@ bool XsdTypeChecker::checkConstrainingFacetsDateTime(const QDateTime &value, con
         bool found = false;
         for (int j = 0; j < multiValue.count(); ++j) {
             const QString pattern = multiValue.at(j)->as<DerivedString<TypeString> >()->stringValue();
-            const QRegExp exp = PatternPlatform::parsePattern(pattern, m_context, m_reflection);
+            QRegExp exp = PatternPlatform::parsePattern(pattern, m_context, m_reflection);
             if (exp.exactMatch(lexicalValue)) {
                 found = true;
                 break;
@@ -898,7 +898,7 @@ bool XsdTypeChecker::checkConstrainingFacetsDuration(const AtomicValue::Ptr&, co
         bool found = false;
         for (int j = 0; j < multiValue.count(); ++j) {
             const QString pattern = multiValue.at(j)->as<DerivedString<TypeString> >()->stringValue();
-            const QRegExp exp = PatternPlatform::parsePattern(pattern, m_context, m_reflection);
+            QRegExp exp = PatternPlatform::parsePattern(pattern, m_context, m_reflection);
             if (exp.exactMatch(lexicalValue)) {
                 found = true;
                 break;
@@ -925,7 +925,7 @@ bool XsdTypeChecker::checkConstrainingFacetsBoolean(bool, const QString &lexical
         bool found = false;
         for (int j = 0; j < multiValue.count(); ++j) {
             const QString pattern = multiValue.at(j)->as<DerivedString<TypeString> >()->stringValue();
-            const QRegExp exp = PatternPlatform::parsePattern(pattern, m_context, m_reflection);
+            QRegExp exp = PatternPlatform::parsePattern(pattern, m_context, m_reflection);
             if (exp.exactMatch(lexicalValue)) {
                 found = true;
                 break;
@@ -1038,7 +1038,7 @@ bool XsdTypeChecker::checkConstrainingFacetsQName(const QXmlName &value, const Q
         bool found = false;
         for (int j = 0; j < multiValue.count(); ++j) {
             const QString pattern = multiValue.at(j)->as<DerivedString<TypeString> >()->stringValue();
-            const QRegExp exp = PatternPlatform::parsePattern(pattern, m_context, m_reflection);
+            QRegExp exp = PatternPlatform::parsePattern(pattern, m_context, m_reflection);
             if (exp.exactMatch(lexicalValue)) {
                 found = true;
                 break;
@@ -1215,7 +1215,7 @@ bool XsdTypeChecker::checkConstrainingFacetsList(const QStringList &values, cons
         bool found = false;
         for (int j = 0; j < multiValue.count(); ++j) {
             const QString pattern = multiValue.at(j)->as<DerivedString<TypeString> >()->stringValue();
-            const QRegExp exp = PatternPlatform::parsePattern(pattern, m_context, m_reflection);
+            QRegExp exp = PatternPlatform::parsePattern(pattern, m_context, m_reflection);
             if (exp.exactMatch(lexicalValue)) {
                 found = true;
                 break;
@@ -1272,7 +1272,7 @@ bool XsdTypeChecker::checkConstrainingFacetsUnion(const QString &value, const QS
         bool found = false;
         for (int j = 0; j < multiValue.count(); ++j) {
             const QString pattern = multiValue.at(j)->as<DerivedString<TypeString> >()->stringValue();
-            const QRegExp exp = PatternPlatform::parsePattern(pattern, m_context, m_reflection);
+            QRegExp exp = PatternPlatform::parsePattern(pattern, m_context, m_reflection);
             if (exp.exactMatch(lexicalValue)) {
                 found = true;
                 break;
diff --git a/tests/auto/qxmlquery/tst_qxmlquery.cpp b/tests/auto/qxmlquery/tst_qxmlquery.cpp
index 372bcdbecc26dac259f921395e4930ed3c33957c..1b5d424a8e2ed51443c5b5f107fa81cd30a7dff0 100644
--- a/tests/auto/qxmlquery/tst_qxmlquery.cpp
+++ b/tests/auto/qxmlquery/tst_qxmlquery.cpp
@@ -1728,7 +1728,7 @@ void tst_QXmlQuery::messageXML() const
 
     query.setQuery(QLatin1String("1basicSyntaxError"));
 
-    const QRegExp removeFilename(QLatin1String("Location: file:.*\\#"));
+    QRegExp removeFilename(QLatin1String("Location: file:.*\\#"));
     QVERIFY(removeFilename.isValid());
 
     QVERIFY(messageValidator.success());
diff --git a/tests/auto/xmlpatterns/tst_xmlpatterns.cpp b/tests/auto/xmlpatterns/tst_xmlpatterns.cpp
index abae5d8992770dc9a58cf08a909965ffa5472f65..29efbe476a98f45849315a8ee637b8f7fbfadced 100644
--- a/tests/auto/xmlpatterns/tst_xmlpatterns.cpp
+++ b/tests/auto/xmlpatterns/tst_xmlpatterns.cpp
@@ -182,7 +182,7 @@ void tst_XmlPatterns::xquerySupport()
         {
             /* There's a wide range of different version strings used. For
              * instance, "4.4.0-rc1". */
-            const QRegExp removeVersion(QLatin1String(" Qt \\d\\.\\d.*"));
+            QRegExp removeVersion(QLatin1String(" Qt \\d\\.\\d.*"));
             QVERIFY(removeVersion.isValid());
             QCOMPARE(QString(fixedStderr).remove(removeVersion) + QChar('|'), rawExpectedStdErr + QChar('|'));
         }
diff --git a/tools/xmlpatterns/qapplicationargumentparser.cpp b/tools/xmlpatterns/qapplicationargumentparser.cpp
index 62bd3e2f6b72438502210c2b964e19c504b3af06..008d905939963b61c843af224f7877dcf41c54b0 100644
--- a/tools/xmlpatterns/qapplicationargumentparser.cpp
+++ b/tools/xmlpatterns/qapplicationargumentparser.cpp
@@ -824,7 +824,7 @@ QVariant QApplicationArgumentParser::convertToValue(const QApplicationArgument &
         }
         case QVariant::RegExp:
         {
-            const QRegExp exp(input);
+            QRegExp exp(input);
 
             if(exp.isValid())
                 return QVariant(exp);