diff --git a/apps/opencs/model/filter/textnode.cpp b/apps/opencs/model/filter/textnode.cpp index 4f76004961..7d837f9e54 100644 --- a/apps/opencs/model/filter/textnode.cpp +++ b/apps/opencs/model/filter/textnode.cpp @@ -13,6 +13,8 @@ CSMFilter::TextNode::TextNode(int columnId, const std::string& text) : mColumnId(columnId) , mText(text) + , mRegExp(QRegularExpression::anchoredPattern(QString::fromUtf8(mText.c_str())), + QRegularExpression::CaseInsensitiveOption) { } @@ -57,9 +59,7 @@ bool CSMFilter::TextNode::test(const CSMWorld::IdTableBase& table, int row, cons return false; /// \todo make pattern syntax configurable - QRegularExpression regExp(QRegularExpression::anchoredPattern(QString::fromUtf8(mText.c_str())), - QRegularExpression::CaseInsensitiveOption); - QRegularExpressionMatch match = regExp.match(string); + QRegularExpressionMatch match = mRegExp.match(string); return match.hasMatch(); } diff --git a/apps/opencs/model/filter/textnode.hpp b/apps/opencs/model/filter/textnode.hpp index 6792c5407b..14efa0a3a0 100644 --- a/apps/opencs/model/filter/textnode.hpp +++ b/apps/opencs/model/filter/textnode.hpp @@ -5,6 +5,8 @@ #include #include +#include + #include #include "leafnode.hpp" @@ -15,6 +17,7 @@ namespace CSMFilter { int mColumnId; std::string mText; + QRegularExpression mRegExp; public: TextNode(int columnId, const std::string& text);