title: Why does this `grep -o` fail, and how should I work around it?
body: <p>Given the input</p>
  
  <pre><code>echo abc123def | grep -o '[0-9]*'
  </code></pre>
  
  <p>On one computer (with GNU grep  2.5.4), this returns <code>123</code>, and on another (with GNU grep 2.5.1) it returns the empty string. Is there some explanation for why grep 2.5.1 fails here, or is it just a bug? I'm using <code>grep -o</code> in this way in a bash script that I'd like to be able to run on different computers (which may have different versions of grep). Is there a "right way" to get consistent behavior?</p>