title: Replacing regex groups with sed
body: <p>I'm trying to replace (with sed) a group matched with a regex, but the best I can get out of my tests is a string that replaces the entire string on the right side of the sed separator.</p>
  
  <p>Example:</p>
  
  <pre><code>echo "this is a sample id='42' string" | sed -r "s/id='(.*?)'/\11/g"
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>this is a sample 421 string
  </code></pre>
  
  <p>Desired output:</p>
  
  <pre><code>this is a sample id='1' string
  </code></pre>
  
  <p>Is this possible? How?</p>
  
  <p>EDIT:</p>
  
  <p>What I'm trying to do is to actually replace <em>just</em> the group matched by the regex, not the entire string on the left side of the sed script.
  Said with other words: I want to replace just the '42' with '1' without using "id=''".</p>