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

QRegExp minimal matching is not minimal enough

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Done
    • Not Evaluated
    • 5.0.0
    • 4.7.1
    • None

    Description

      QString c = "We must be <b>bold</b>, very <b>bold</b>!";
      QRegExp r;
      r.setMinimal(true);
      r.setPattern("<b>(.*)</b>");
      c.indexOf(r);
      qDebug() << r.cap(1);
      r.setPattern("<b>(.*)</b>.*!");
      c.indexOf(r);
      qDebug() << r.cap(1);
      

      got:
      "bold"
      "bold</b>, very <b>bold"
      expected:
      "bold"
      "bold"

      When there is more than one asterisk, minimal matching should be applied to the one in matching group.

      Attachments

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

        Activity

          People

            w00t Robin Burchell
            kamil Kamil Ostaszewski
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes