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

QRegularExpression wrong behavior (behaves differently from QRegExp)

    XMLWordPrintable

Details

    • All
    • b22ae069a (dev), e9b42b857 (6.4), 2df508a41 (6.5)

    Description

      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.

      Attachments

        1. Screen Shot 2023-01-24 at 12.14.16 PM.png
          58 kB
          Shugang Kang
        2. test.cpp
          1 kB
          Shugang Kang
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: