Qt 6.11 is out! See what's new in the release
blog
QRegularExpression and cyrillic
-
I need to find the whole word in a text.
I use this code:QString txt("У лукоморья дуб зелёный") auto exp = QRegularExpression(QString("\\bдуб\\b")); bool find = txt.contains(exp);but this code work only with english text not cyrillic.
How can I fix it?
-
Hi,
You need to tell QRegularExpression that you are working on Unicode:
auto exp = QRegularExpression(QString("\bдуб\b"), QRegularExpression::UseUnicodePropertiesOption);And you should be good to go.