/***************************************************************************
- * 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 *
#include <QString>
#include <QStringList>
-#include "logmessage.h"
-
ExpressionMatch::ExpressionMatch(const QString& expression, MatchMode mode, bool caseSensitive)
{
// Store the original parameters for later reference
// 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()) {