title: Regex to extract similar config blocks throughout ini file
body: <p>I want to extract the hostname and node id values from the [ndb_mgmd] blocks <strong>only</strong>, from the mysql ini config file. There are other blocks in the file which are not needed.</p>
  <ol>
  <li>Is it possible to extract just the hostname and node id values from all the [ndb_mgmd] blocks?</li>
  <li>Otherwise, how can I extract those whole blocks using regex (without the [ndb_mgmd] headers preferably)?</li>
  </ol>
  <p>Config file example below.</p>
  <pre><code>Random unwanted text in config file
  
  [unwanted_block]
  hostname=0.0.0.0
  NodeId=2
  
  [ndb_mgmd]
  hostname=2.2.2.2
  NodeId=1
  
  [mysql_unwanted]
  hostname=3.3.3.3
  NodeId=6
  
  [ndb_mgmd]
  hostname=2.2.2.2
  NodeId=4
  
  randomconfig
  </code></pre>
  <p>Thanks</p>