title: In Bash, how do you find and crop a string around a wildcard pattern
body: <p>I want to crop a string around a wildcard (or a pattern using a wildcard) in Bash, preferably using parameter expressions or grep, anything but sed if it's possible. And then get that wildcard in a variable.</p>
  
  <p>Example of string:</p>
  
  <pre><code>DESERT=pie-cake_berry_cream-sirup
  </code></pre>
  
  <p>And I have a pattern with a wildcard:</p>
  
  <blockquote>
    <p>_*_</p>
  </blockquote>
  
  <p>The pattern will match with "_berry_" on my string. I want to run a bash command over my string, and return "berry" if I use this particular pattern.</p>