title: In Qt, what takes the least amount of code to replace string matches with regular expression captures?
body: <p>I was hoping that QString would allow this:</p>
  
  <pre><code>QString myString("School is LameCoolLame and LameRadLame");
  myString.replace(QRegularExpression("Lame(.+?)Lame"),"\1");
  </code></pre>
  
  <p>Leaving</p>
  
  <pre><code>"School is Cool and Rad"
  </code></pre>
  
  <p>Instead from what I saw in the docs, doing this is a lot more convoluted requiring you to do (from the docs):</p>
  
  <pre><code>QRegularExpression re("\\d\\d \\w+");
  QRegularExpressionMatch match = re.match("abc123 def");
  if (match.hasMatch()) {
      QString matched = match.captured(0); // matched == "23 def"
      // ...
  }
  </code></pre>
  
  <p>Or in my case something like this:</p>
  
  <pre><code>QString myString("School is LameCoolLame and LameRadLame");
  QRegularExpression re("Lame(.+?)Lame");
  QRegularExpressionMatch match = re.match(myString);
  if (match.hasMatch()) {
      for (int i = 0; i &lt; myString.count(re); i++) {
          QString newString(match.captured(i));
          myString.replace(myString.indexOf(re),re.pattern().size, match.captured(i));
      }
  }
  </code></pre>
  
  <p>And that doesn't even seem to work, (I gave up actually). There must be an easier more convenient way. For the sake of simplicity and code readability, I'd like to know the methods which take the least lines of code to accomplish this.</p>
  
  <p>Thanks. </p>