Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.14.0
-
None
-
-
9f1948f59b916966ea0ecdf9c7d3473f7685e08e (qt/qtbase/5.14)
Description
QRegularExpression::wildcardToRegularExpression() returns a pattern anchored with \A and \z, the issue is that the documentation doesn't mention that fact, which means that when porting code that used QRegExp::exactMatch() and QRegExp::WildCard the code could end up like this:
QRegularExpression::anchoredPattern(QRegularExpression::wildcardToRegularExpression(pattern))
which means the pattern is anchored twice, which is wrong.
This was pointed out to me by a KDE developer/contributor in a code review: https://phabricator.kde.org/D26205
Harald Sitter on IRC #kde-devel also pointed out that https://code.qt.io/cgit/qt/qtbase.git/tree/src/corelib/io/qdiriterator.cpp#n184 has the same problem.
Attachments
For Gerrit Dashboard: QTBUG-81396 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
286788,2 | QRegularExpression: fixup docs of wildcardToRegularExpression | 5.14 | qt/qtbase | Status: MERGED | +2 | 0 |
286790,2 | Do not anchor an already-anchored regexp | 5.15 | qt/qtbase | Status: MERGED | +2 | 0 |