gui: PreviewGeneratorPlaintext: Escape words we pass to QRegularExpression

这个提交包含在:
Albert S. 2022-11-13 17:27:45 +01:00
父节点 d55187a71c
当前提交 abce4cfcd9
共有 1 个文件被更改,包括 1 次插入1 次删除

查看文件

@ -103,7 +103,7 @@ QString PreviewGeneratorPlainText::generateLineBasedPreviewText(QTextStream &in,
int foundWordsCount = 0;
for(QString &word : config.wordsToHighlight)
{
QRegularExpression searchRegex("\\b" + word + "\\b");
QRegularExpression searchRegex("\\b" + QRegularExpression::escape(word) + "\\b");
bool containsRegex = line.contains(searchRegex);
bool contains = false;
if(!containsRegex)