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

@@ -12,6 +12,7 @@
#include <QJsonObject>
#include <QJsonValue>
#include <QRegularExpression>
#include <Qt>
namespace BlackMisc
@@ -33,9 +34,9 @@ namespace BlackMisc
{
if (countryName.isEmpty()) { return CCountry(); }
static const QRegExp reg("^[a-z]+", Qt::CaseInsensitive);
int pos = reg.indexIn(countryName);
const QString cn(pos >= 0 ? reg.cap(0) : countryName);
thread_local const QRegularExpression reg("^[a-z]+", QRegularExpression::CaseInsensitiveOption);
QRegularExpressionMatch match = reg.match(countryName);
const QString cn(match.hasMatch() ? match.captured(0) : countryName);
CCountryList countries = this->findBy([&](const CCountry & country)
{
return country.matchesCountryName(cn);