Qt: replace QRegExp with QRegularExpression in FilterListModel.
The new class has a more powerful support for non-greedy regexps (required in this case). See: https://doc.qt.io/qt-5/qregularexpression.html#notes-for-qregexp-users Bug: 16336 Change-Id: I4684fbf6aeeb55707d325775de487246ac398c2d Reviewed-on: https://code.wireshark.org/review/35858 Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
parent
17a6916a21
commit
59108b1683
|
@ -19,7 +19,7 @@
|
|||
|
||||
#include <QFile>
|
||||
#include <QTextStream>
|
||||
#include <QRegExp>
|
||||
#include <QRegularExpression>
|
||||
#include <QDir>
|
||||
#include <QMimeData>
|
||||
|
||||
|
@ -73,18 +73,17 @@ void FilterListModel::reload()
|
|||
return;
|
||||
|
||||
QTextStream in(&file);
|
||||
QRegExp rx("\\s*\\\"(.*)\\\"\\s(.*)");
|
||||
QRegularExpression rx("\\s*\\\"(.*?)\\\"\\s(.*)");
|
||||
while (!in.atEnd())
|
||||
{
|
||||
QString line = in.readLine().trimmed();
|
||||
if (line.startsWith("#") || line.indexOf("\"") <= -1)
|
||||
continue;
|
||||
|
||||
rx.indexIn(line);
|
||||
QStringList groups = rx.capturedTexts();
|
||||
if (groups.count() != 3)
|
||||
continue;
|
||||
addFilter(groups.at(1), groups.at(2));
|
||||
QRegularExpressionMatch match = rx.match(line);
|
||||
if (match.hasMatch()) {
|
||||
addFilter(match.captured(1), match.captured(2));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue