Reputation: 4617
I am porting some Qt5 code to Qt6, which requires switching QRegExp to QRegularExpression. The Qt5 code uses the setMinimal(bool minimal) method of QRegExp. Is there an equivalent PatternOption in Qt6?
I see a QRegularExpression::InvertedGreedinessOption PatternOption, but I don't really understand if this is equivalent.
Upvotes: 0
Views: 308
Reputation: 2365
From Qt6 documentation, Minimal matching says:
QRegExp::setMinimal() implemented minimal matching by simply reversing the greediness of the quantifiers (QRegExp did not support lazy quantifiers, like *?, +?, etc.). QRegularExpression instead does support greedy, lazy, and possessive quantifiers.
The QRegularExpression::InvertedGreedinessOption pattern option can be useful to emulate the effects of QRegExp::setMinimal(): if enabled, it inverts the greediness of quantifiers (greedy ones become lazy and vice versa).
Upvotes: 0