-
Bug
-
Resolution: Fixed
-
Not Evaluated
-
5.15.15
-
None
-
-
b22ae069a (dev), e9b42b857 (6.4), 2df508a41 (6.5)
QRegularExpression and QRegExp behave differently.
The behavior of the QRegExp is correct.
The behavior of the QRegularExpression is not correct (at least for test #1)
const QString source = u8"𤭢abcCBA!!!𤭢¥/:/¥𤭢abbbb:/:"; { const QRegExp regex(u8"𤭢"); int c = source.count(regex); std::cout << "QRegExp test #1: Expected: 3, and result is: " << c << std::endl; } { const QRegularExpression regex(u8"𤭢"); int c = source.count(regex); std::cout << "QRegularExpression test #1: Expected: 3, but result is: " << c << std::endl; }
To show the special characters, here is a screenshot:

The output is:
QRegExp test #1: Expected: 3, and result is: 3 QRegularExpression test #1: Expected: 3, but result is: 1
The test program is attached.
| For Gerrit Dashboard: QTBUG-110586 | ||||||
|---|---|---|---|---|---|---|
| # | Subject | Branch | Project | Status | CR | V |
| 456133,2 | QRegularExpression: fix count() when the RE matches a surrogate | dev | qt/qtbase | Status: MERGED | +2 | 0 |
| 457517,2 | QRegularExpression: fix count() when the RE matches a surrogate | 6.4 | qt/qtbase | Status: MERGED | +2 | 0 |
| 457538,2 | QRegularExpression: fix count() when the RE matches a surrogate | 6.5 | qt/qtbase | Status: MERGED | +2 | 0 |
| 457540,1 | QRegularExpression: fix count() when the RE matches a surrogate | tqtc/lts-6.2 | qt/tqtc-qtbase | Status: ABANDONED | -1 | 0 |
| 457541,1 | QRegularExpression: fix count() when the RE matches a surrogate | tqtc/esm-5.15 | qt/tqtc-qtbase | Status: ABANDONED | 0 | 0 |