title: multiline regexp matching in bash
body: <p>I would like to do some multiline matching with bash's <code>=~</code></p>
  
  <pre><code>#!/bin/bash
  str='foo = 1 2 3
  bar = what about 42?
  boo = more words
  '
  re='bar = (.*)'
  if [[ "$str" =~ $re ]]; then
          echo "${BASH_REMATCH[1]}"
  else
          echo no match
  fi
  </code></pre>
  
  <p>Almost there, but if I use <code>^</code> or <code>$</code>, it will not match, and if I don't use them, <code>.</code> eats newlines too.</p>
  
  <p>EDIT:</p>
  
  <p>sorry, values after <code>=</code> could be multi-word values.</p>