fix: add unicodeoption to qregularexpression

This commit is contained in:
Xiao YiFang 2022-06-01 21:15:09 +08:00
parent 35efa7ac06
commit 530591ffbd
3 changed files with 4 additions and 4 deletions

View file

@ -857,7 +857,7 @@ bool EpwingBook::getNextHeadword( EpwingHeadword & head )
{ {
EB_Position pos; EB_Position pos;
QRegularExpression badLinks( "#(v|n)\\d" ); QRegularExpression badLinks( "#(v|n)\\d", QRegularExpression::UseUnicodePropertiesOption);
// At first we check references queue // At first we check references queue
while( !LinksQueue.isEmpty() ) while( !LinksQueue.isEmpty() )

View file

@ -71,8 +71,8 @@ bool parseSearchString( QString const & str, QStringList & indexWords,
{ {
searchWords.clear(); searchWords.clear();
indexWords.clear(); indexWords.clear();
QRegularExpression spacesRegExp( "\\W+" ); QRegularExpression spacesRegExp( "\\W+", QRegularExpression::UseUnicodePropertiesOption );
QRegularExpression wordRegExp( QString( "\\w{" ) + QString::number( FTS::MinimumWordSize ) + ",}" ); QRegularExpression wordRegExp( QString( "\\w{" ) + QString::number( FTS::MinimumWordSize ) + ",}", QRegularExpression::UseUnicodePropertiesOption );
QRegularExpression setsRegExp( "\\[[^\\]]+\\]", QRegularExpression::CaseInsensitiveOption ); QRegularExpression setsRegExp( "\\[[^\\]]+\\]", QRegularExpression::CaseInsensitiveOption );
QRegularExpression regexRegExp( "\\\\[afnrtvdDwWsSbB]|\\\\x([0-9A-Fa-f]{4})|\\\\0([0-7]{3})", QRegularExpression::CaseInsensitiveOption); QRegularExpression regexRegExp( "\\\\[afnrtvdDwWsSbB]|\\\\x([0-9A-Fa-f]{4})|\\\\0([0-7]{3})", QRegularExpression::CaseInsensitiveOption);

View file

@ -3503,7 +3503,7 @@ void MainWindow::on_saveArticle_triggered()
// MDict anchors // MDict anchors
QRegularExpression anchorLinkRe( QRegularExpression anchorLinkRe(
"(<\\s*a\\s+[^>]*\\b(?:name|id)\\b\\s*=\\s*[\"']*g[0-9a-f]{32}_)([0-9a-f]+_)(?=[^\"'])", "(<\\s*a\\s+[^>]*\\b(?:name|id)\\b\\s*=\\s*[\"']*g[0-9a-f]{32}_)([0-9a-f]+_)(?=[^\"'])",
QRegularExpression::PatternOption::CaseInsensitiveOption ); QRegularExpression::PatternOption::CaseInsensitiveOption|QRegularExpression::UseUnicodePropertiesOption );
html.replace( anchorLinkRe, "\\1" ); html.replace( anchorLinkRe, "\\1" );
if( complete ) if( complete )