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

The regular expression finds only the first parameter in Qt5

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Invalid
    • Icon: Not Evaluated Not Evaluated
    • None
    • 5.12.4
    • None
    • MinGW32 7.3.0 - Windows 7x86.
    • Windows

      According to the plan there should be two elements, but only the first one is defined.

      QRegExp rx("\\d+"); QString buf_last; buf_last.append("read0_1"); 
      rx.indexIn(buf_last); 
      auto try_step = rx.cap(0).toInt();
      auto current_step = rx.cap(1).toInt(); 
      
      qDebug() << try_step << current_step << buf_last << "rx___" << rx.cap(0) << rx.cap(1) << rx.capturedTexts();
      
      result:
      0 0 "read0_1" rx___ "0" "" ("0")

       

      Working if used:

      QRegExp rx("(\\d+)");

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

            thiago Thiago Macieira
            gg.shaman888 gg.shaman888
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes