Skip to content

Commit

Permalink
Dot matches newlines in regexps
Browse files Browse the repository at this point in the history
in filter and search, otherwise surprising behavior if payload contains
newline chars

Signed-off-by: Tobias Hammer <[email protected]>
  • Loading branch information
tohammer committed Dec 19, 2023
1 parent e8b6bb9 commit 61e4343
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
5 changes: 3 additions & 2 deletions qdlt/qdltfilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,9 @@ bool QDltFilter::compileRegexps()
ignoreCase_Header ? QRegularExpression::CaseInsensitiveOption
: QRegularExpression::NoPatternOption);
payloadRegularExpression.setPatternOptions(
ignoreCase_Payload ? QRegularExpression::CaseInsensitiveOption
: QRegularExpression::NoPatternOption);
QRegularExpression::DotMatchesEverythingOption |
(ignoreCase_Payload ? QRegularExpression::CaseInsensitiveOption
: QRegularExpression::NoPatternOption));

return (headerRegularExpression.isValid() &&
payloadRegularExpression.isValid() &&
Expand Down
14 changes: 4 additions & 10 deletions src/searchdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -290,16 +290,10 @@ int SearchDialog::find()
return 1;
}

searchTextRegExpression.setPatternOptions(QRegularExpression::CaseInsensitiveOption);
if ( getCaseSensitive() == true )
{
searchTextRegExpression.setPatternOptions(QRegularExpression::NoPatternOption);
}
else
{
searchTextRegExpression.setPatternOptions(QRegularExpression::CaseInsensitiveOption);
}

int options = QRegularExpression::DotMatchesEverythingOption;
if (!getCaseSensitive())
options |= QRegularExpression::CaseInsensitiveOption;
searchTextRegExpression.setPatternOptions(static_cast<QRegularExpression::PatternOption>(options));
}

//check timestamp search pattern
Expand Down

0 comments on commit 61e4343

Please sign in to comment.