mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-02 06:35:52 +08:00
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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user