title: Shell equivalent of php preg_match?
body: <p>Is there a shell equivalent of PHP's preg_match?</p>
  
  <p>I'm trying to extract the database name from this string in a shell script.</p>
  
  <pre><code>define('DB_NAME', 'somedb');
  </code></pre>
  
  <p>Using preg_match in PHP I could just do something like this. </p>
  
  <pre><code>preg_match('define(\'DB_NAME\','(.*)'\'\)',$matches);
  echo $matches[1];
  </code></pre>
  
  <p>How can I accomplish the same thing in a shell script?</p>