From d99618d2f6aede846c1d7981e672b73c48fcdc27 Mon Sep 17 00:00:00 2001 From: WarmUpTill Date: Sat, 10 Sep 2022 22:17:40 +0200 Subject: [PATCH] Enable multiline regex pattern matching --- src/macro-core/macro-condition-file.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/macro-core/macro-condition-file.cpp b/src/macro-core/macro-condition-file.cpp index 7cd0c69f..d756890a 100644 --- a/src/macro-core/macro-condition-file.cpp +++ b/src/macro-core/macro-condition-file.cpp @@ -51,12 +51,12 @@ bool MacroConditionFile::matchFileContent(QString &filedata) } if (_useRegex) { - try { - std::regex expr(_text); - return std::regex_match(filedata.toStdString(), expr); - } catch (const std::regex_error &) { + QRegularExpression expr(QString::fromStdString(_text)); + if (!expr.isValid()) { return false; } + auto match = expr.match(filedata); + return match.hasMatch(); } QString text = QString::fromStdString(_text);