Replace QRegExp with QRegularExpression

Reviewers: kbasan, msutcliffe

Reviewed By: kbasan, msutcliffe

Subscribers: jenkins

Differential Revision: https://dev.swift-project.org/D11
This commit is contained in:
Mathew Sutcliffe
2017-05-05 22:35:25 +01:00
parent 94fbfeefdb
commit d5ab73e1bc
17 changed files with 55 additions and 54 deletions

View File

@@ -346,7 +346,7 @@ namespace BlackMisc
{
if (errorMessage.isEmpty()) { return errorMessage; }
QString phpError(errorMessage);
static const QRegularExpression regEx("<[^>]*>");
thread_local const QRegularExpression regEx("<[^>]*>");
return phpError.remove(regEx);
}

View File

@@ -14,7 +14,7 @@
#include "blackmisc/pq/constants.h"
#include "blackmisc/pq/physicalquantity.h"
#include <QRegExp>
#include <QRegularExpression>
#include <Qt>
#include <QtGlobal>
@@ -176,7 +176,7 @@ namespace BlackMisc
if (this->isEmpty()) return invalid;
if (this->isPrivateMessage()) return invalid;
if (this->m_message.length() > 15 || this->m_message.length() < 10) return invalid; // SELCAL AB-CD -> 12, I allow some more characters as I do not know wheter in real life it exactly matches
QString candidate = this->m_message.toUpper().remove(QRegExp("[^A-Z]")); // SELCALABCD
QString candidate = this->m_message.toUpper().remove(QRegularExpression("[^A-Z]")); // SELCALABCD
if (candidate.length() != 10) return invalid;
if (!candidate.startsWith("SELCAL")) return invalid;
return candidate.right(4).toUpper();