title: How to make sed do non-greedy match?
body: <p>I cannot seem to figure out how to come up with the correct regex for my bash command line.
  Here's what I am doing:</p>
  
  <pre><code>echo "XML-Xerces-2.7.0-0.tar.gz" | sed -e's/^\(.*\)-[0-9].*/\1/g'
  </code></pre>
  
  <p>This gives me the output of ...</p>
  
  <pre><code>XML-Xerces-2.7.0
  </code></pre>
  
  <p>... but want I need is the output to be ...</p>
  
  <pre><code>XML-Xerces
  </code></pre>
  
  <p>... I guess I could do this ...</p>
  
  <pre><code> echo "XML-Xerces-2.7.0-0.tar.gz" | sed -e's/^\(.*\)-[0-9].*/\1/g' | sed -e's/^\(.*\)-[0-9].*/\1/g'
  </code></pre>
  
  <p>... but I would like to know how understand <code>sed</code> regex a little better.</p>
  
  <p>Update: </p>
  
  <p>I tried this ...</p>
  
  <pre><code>echo "XML-Xerces-2.7.0-0.tar.gz" | sed -e's/^\([^-]*\)-[0-9].*/\1/g'
  </code></pre>
  
  <p>... as suggest but that outputs <code>XML-Xerces-2.7.0-0.tar.gz</code></p>