gui: PreviewGeneratorPlaintext: Escape words we pass to QRegularExpression

This commit is contained in:
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)