mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-24 00:14:06 +00:00
Fix bug in full-text search in "RegExp" mode
This commit is contained in:
parent
38adb08ea9
commit
e037533424
|
@ -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, " " );
|
||||
|
||||
|
|
Loading…
Reference in a new issue