title: How to retrieve information in the first section of the raw data only by regular expressions?
body: <p>Below is a sample of the raw data which my code will process by regular expressions:</p>
  <pre><code>raw_data = '''
  name        :   John
  age         :   26
  gender      :   male
  occupation  :   teacher
  
  Father
  ---------------------
  name        :   Bill
  age         :   52
  gender      :   male
  
  Mother
  ---------------------
  name        :   Mary
  age         :   48
  gender      :   female
  '''
  </code></pre>
  <p>I want to retrieve the following part of information from the raw data and store it in a dictionary:</p>
  <pre><code>dict(name = 'John', age = 26, gender = 'male', occupation = 'teacher')
  </code></pre>
  <p>However, when I run my code as follows, it does not work as I expect:</p>
  <pre><code>import re
  p = re.compile('[^-]*?^([^:\-]+?):([^\r\n]*?)$', re.M)
  rets = p.findall(raw_data)
  
  infoAboutJohnAsDict = {}
  
  if rets != []:
    for ret in rets:
      infoAboutJohnAsDict[ret[0]] = ret[1]
  else:
    print(&quot;Not match.&quot;)
  
  print(f'rets = {rets}')
  print(f'infoAboutJohnAsDict = {infoAboutJohnAsDict}')
  </code></pre>
  <p>Can anyone give me any suggestion about how I should modify my code to achieve what I intend to do?</p>