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

QRegularExpression wrong behavior (behaves differently from QRegExp)

XMLWordPrintable

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

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

            thiago Thiago Macieira
            shugang Shugang Kang
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: