Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-81396

QRegularExpression::wildcardToRegularExpression() docs should state it returns an anchored pattern

    XMLWordPrintable

Details

    • All
    • 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

        Activity

          People

            peppe Giuseppe D'Angelo
            ahmad.samir Ahmad Samir
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes