From e037533424dc8c5b574ed23249fda429d186a516 Mon Sep 17 00:00:00 2001 From: Abs62 Date: Thu, 31 Dec 2015 15:42:33 +0300 Subject: [PATCH] Fix bug in full-text search in "RegExp" mode --- ftshelpers.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ftshelpers.cc b/ftshelpers.cc index 4b3c23c8..17e3e69a 100644 --- a/ftshelpers.cc +++ b/ftshelpers.cc @@ -42,6 +42,7 @@ bool parseSearchString( QString const & str, QStringList & indexWords, QRegExp spacesRegExp( "\\W+" ); QRegExp wordRegExp( QString( "\\w{" ) + QString::number( FTS::MinimumWordSize ) + ",}" ); QRegExp setsRegExp( "\\[[^\\]]+\\]", Qt::CaseInsensitive, QRegExp::RegExp2 ); + QRegExp regexRegExp( "\\\\[afnrtvdDwWsSbB]|\\\\x([0-9A-Fa-f]{4})|\\\\0([0-7]{3})", Qt::CaseSensitive, QRegExp::RegExp2 ); hasCJK = false; for( int x = 0; x < str.size(); x++ ) @@ -100,6 +101,10 @@ bool parseSearchString( QString const & str, QStringList & indexWords, QString tmp = str; + // Remove RegExp commands + if( searchMode == FTS::RegExp ) + tmp.replace( regexRegExp, " " ); + // Remove all symbol sets tmp.replace( setsRegExp, " " );