X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fcommon%2Fexpressionmatch.cpp;h=f9c834aed59f498f1ed9925f8e275051a8379515;hb=2491fb92519912fa2169fb9d7dbc631a03bf5570;hp=17d08a528ff7fa64e85a9d8dca7aa825501daebc;hpb=c1cf157116de7fc3da96203aa6f03c38c7ebb650;p=quassel.git diff --git a/src/common/expressionmatch.cpp b/src/common/expressionmatch.cpp index 17d08a52..f9c834ae 100644 --- a/src/common/expressionmatch.cpp +++ b/src/common/expressionmatch.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2018 by the Quassel Project * + * Copyright (C) 2005-2020 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -25,8 +25,6 @@ #include #include -#include "logmessage.h" - ExpressionMatch::ExpressionMatch(const QString& expression, MatchMode mode, bool caseSensitive) { // Store the original parameters for later reference @@ -379,17 +377,21 @@ void ExpressionMatch::cacheRegEx() // level as ideally someone's not just going to leave a broken match rule around. For // MatchRegEx, they probably need to fix their regex rule. For the other modes, there's // probably a bug in the parsing routines (which should also be fixed). - quInfo() << "Could not parse expression match rule" << _sourceExpression << "(match mode:" << (int)_sourceMode + qInfo() << "Could not parse expression match rule" << _sourceExpression << "(match mode:" << (int)_sourceMode << "), this rule will be ignored"; } } QRegularExpression ExpressionMatch::regExFactory(const QString& regExString, bool caseSensitive) { - // Construct the regular expression object, setting case sensitivity as appropriate - QRegularExpression newRegEx = QRegularExpression(regExString, - caseSensitive ? QRegularExpression::PatternOption::NoPatternOption - : QRegularExpression::PatternOption::CaseInsensitiveOption); + // This is required, else extra-ASCII codepoints get treated as word boundaries + QRegularExpression::PatternOptions options = QRegularExpression::UseUnicodePropertiesOption; + + if (!caseSensitive) { + options |= QRegularExpression::CaseInsensitiveOption; + } + + QRegularExpression newRegEx = QRegularExpression(regExString, options); // Check if rule is valid if (!newRegEx.isValid()) {