title: BSD grep "?" wildcard alternative for GNU
body: <p>I have a grep command that works on my Mac with BSD grep 2.5.1-FreeBSD which I'm using to search a very long, single-line bash var: </p>
  
  <p><code>echo $MY_VAR | grep -Eo s3.+?model</code></p>
  
  <p>On Ubuntu with GNU grep 2.25, the <code>?</code> wildcard doesn't seem to work. It doesn't stop at the first occurrence of "model". </p>
  
  <p>Would someone please show me how to get this same match in Ubuntu? Open to either changing the pattern or installing a different/updated grep.</p>
  
  <p>Not going to list the million patterns I've tried so far, but been struggling for a while with this.</p>
  
  <p><strong>Edit:</strong> The following seems to work since there's a "," after "model", but looks pretty ugly: </p>
  
  <p><code>egrep -o 's3.*model' | grep -o '^[^,]*'</code></p>
  
  <p>Is there a better way?</p>