title: Non greedy (reluctant) regex matching in sed?
body: <p>I'm trying to use sed to clean up lines of URLs to extract just the domain.</p>
  
  <p>So from:</p>
  
  <pre><code>http://www.suepearson.co.uk/product/174/71/3816/
  </code></pre>
  
  <p>I want:</p>
  
  <pre><code>http://www.suepearson.co.uk/
  </code></pre>
  
  <p>(either with or without the trailing slash, it doesn't matter)</p>
  
  <p>I have tried:</p>
  
  <pre><code> sed 's|\(http:\/\/.*?\/\).*|\1|'
  </code></pre>
  
  <p>and (escaping the non-greedy quantifier)</p>
  
  <pre><code>sed 's|\(http:\/\/.*\?\/\).*|\1|'
  </code></pre>
  
  <p>but I can not seem to get the non-greedy quantifier (<code>?</code>) to work, so it always ends up matching the whole string.</p>