title: Sed using extended regexp and capture groups
body: <p>I wrote the following sed one liner for substituting the 3rd portion of an IP address.</p>
  
  <pre><code>sed 's/192\.168\.[0-9]*\.\([0-9]*\)/192.168.15.\1/g'
  
  192.168.0.1
  192.168.15.1
  </code></pre>
  
  <p>I want to make it lazy so it would replace <code>192.168.0</code> with <code>192.168.15</code> by using <code>??</code> which is extended regexp but when I supply the '-r' option I get the following error.</p>
  
  <pre><code>$ sed -r 's/192\.168\.[0-9]*\.\([0-9]*\)/192.168.15.\1/g'
  sed: -e expression #1, char 44: invalid reference \1 on `s' command's RHS
  </code></pre>
  
  <p>Can you explain what is going on here and how to make an expression lazy whilst using capture groups?</p>
  
  <p><em>Note: I can achieve the example using many different approaches, my question isn't how to solve the example. I am interesting in using sed with exteneded regexp and capture groups.</em></p>