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

Regexp negation doesn't work for backreferences

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Not Evaluated
    • 5.0.0
    • 4.8.0
    • Core: Other
    • None

    Description

      #include <QRegExp>
      #include <QDebug>
      
      int main()
      {
        QRegExp exp("([^,]+),(\\1)");
        QRegExp exp_neg("([^,]+),(?!\\1)");
        QString line = "foo,foo";
        QString line2 = "foo,bar";
        qDebug() << exp.pattern() << " in " << line << exp.indexIn(line); // 0
        qDebug() << exp.pattern() << " in " << line2 << exp.indexIn(line2); // -1
        qDebug() << exp_neg.pattern() << " in " << line << exp_neg.indexIn(line); // -1
        qDebug() << exp_neg.pattern() << " in " << line2 << exp_neg.indexIn(line2); // -1 (should be 0)
        return 0;
      }

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            w00t Robin Burchell
            orgads Orgad Shaneh
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes