From fdae7fd065a69c88a77fc64641aa8f0d5398fe08 Mon Sep 17 00:00:00 2001 From: Albert S Date: Sun, 5 Jun 2022 23:37:57 +0200 Subject: [PATCH] shared: LooqsQuery: Use unicode category class in regex --- shared/looqsquery.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/shared/looqsquery.cpp b/shared/looqsquery.cpp index 5da291c..fe6869d 100644 --- a/shared/looqsquery.cpp +++ b/shared/looqsquery.cpp @@ -180,8 +180,9 @@ LooqsQuery LooqsQuery::build(QString expression, TokenType loneWordsTokenType, b QStringList loneWords; LooqsQuery result; - QRegularExpression rx("((?(\\.|\\w)+):(?\\((?[^\\)]+)\\)|([\\w,])+)|(?AND|OR)" - "|(?!)|(?\\(|\\))|(?[\"\\w]+))"); + QRegularExpression rx( + "((?(\\.|\\w)+):(?\\((?[^\\)]+)\\)|([\\p{L},])+)|(?AND|OR)" + "|(?!)|(?\\(|\\))|(?[\"\\p{L}]+))"); QRegularExpressionMatchIterator i = rx.globalMatch(expression); auto previousWasBool = [&result] { return !result.tokens.empty() && ((result.tokens.last().type & BOOL) == BOOL); }; auto previousWas = [&result](TokenType t) { return !result.tokens.empty() && (result.tokens.last().type == t); };