title: Regex to extract key, value by brackets #2
body: <p>I want to get key and value from text in a [key] value format:</p>
  
  <ol>
  <li>key is not fixed, but it will be in brakets [ ] .</li>
  <li>[key](there can be blank)value format</li>
  <li>value can not have '[', ']'</li>
  <li>value can have new line(\n).</li>
  <li>value can be null.</li>
  <li>last value can be only one line. (ignore 2 or more lines)</li>
  </ol>
  
  <p>For example,</p>
  
  <pre><code>[AA] abcd 1234 !@#$ _+{}[]:"
  blah blah
  [abc-def] this is also value.
  [BB]abcd defg
  [CC]
  
  blah blah
  blah blah
  </code></pre>
  
  <p>In this case, I want to get below pairs.</p>
  
  <p>'AA' : 'abcd 1234 !@#$ _+{}:"
      blah blah'</p>
  
  <p>'abc-def' : 'this is also value.'</p>
  
  <p>'BB' : 'abcd defg'</p>
  
  <p>'CC' : ''</p>
  
  <p>and my Python code is this:</p>
  
  <pre><code>import re
  
  text ='''
  [AA] abcd 1234 !@#$ _+{}:"
  blah blah
  [abc-def] this is also value.
  [BB]abcd defg
  [CC]
  
  blah blah
  blah blah
  '''
  pattern = re.compile(this is what I want)
  result = {m.group('field'):m.group('value') for m in pattern.finditer(text)}
  </code></pre>
  
  <p>Is this possible?</p>