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

QRegularExpression fails to match and is very slow

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • Not Evaluated
    • None
    • 5.15.0
    • None
    • Windows

    Description

      QRegularExpression fails to match a simple string with numerous captures and is very slow.

      	QString s = "7.000000;34311.000000;-63.000000;-11075.438477;81.914001;-1950.119019;-2614.415283;30.500000;4.210000;0.000000;4336.857775;3279.634062;2910.235036;11075.438477;-11075.438477;11075.438477;81.914001;-67.497137;81.914001;0xA079;18;3\r\n"
      "7.000000;34312.000000;-63.000000;-11075.438477;81.914001;-1954.181763;-2606.245117;30.500000;4.210000;0.000000;4336.857775;3279.634062;2910.235036;11075.438477;-11075.438477;11075.438477;81.914001;-67.497137;81.914001;0xA079;18;3\r\n";
      	QString sre = "(.+);(.+);(.+);(.+);(.+);(.+);(.+);(.+);(.+);(.+);(.+);(.+);(.+);(.+);(.+);(.+);(.+);(.+);(.+);(.+);(.+);(.+)\r\n";
      	QRegularExpression re; re.setPattern(sre);
      	qDebug() << re.match(s).hasMatch();
      	auto mi = re.globalMatch(s);
      	while (mi.hasNext()) qDebug() << mi.next().captured(0);
      

      See attached project for better formatted and explained code.

      Attachments

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

        Activity

          People

            peppe Giuseppe D'Angelo
            pro-micron Steffen Mazur
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes