06245f3713
Co-authored-by: pajlada <rasmus.karlsson@pajlada.com>
22 lines
425 B
C++
22 lines
425 B
C++
#include "RegexPredicate.hpp"
|
|
|
|
namespace chatterino {
|
|
|
|
RegexPredicate::RegexPredicate(const QString ®ex)
|
|
: regex_(regex, QRegularExpression::CaseInsensitiveOption)
|
|
{
|
|
}
|
|
|
|
bool RegexPredicate::appliesTo(const Message &message)
|
|
{
|
|
if (!regex_.isValid())
|
|
{
|
|
return false;
|
|
}
|
|
|
|
QRegularExpressionMatch match = regex_.match(message.messageText);
|
|
|
|
return match.hasMatch();
|
|
}
|
|
|
|
} // namespace chatterino
|