title: Regex matching text in brackets over multiple lines
body: <p>I have the following text:</p>
  
  <pre><code>node [
      id 2
      label "node 2"
      thisIsASampleAttribute 43
  ]
  node [
      id 3
      label "node 3"
      thisIsASampleAttribute 44
  ]
  </code></pre>
  
  <p>And I want to group each node and its content inside the brackets e.g:</p>
  
  <pre><code>    node [
      id 2
      label "node 2"
      thisIsASampleAttribute 43
  ]
  </code></pre>
  
  <p>However I'm grouping the entire text with my following code:</p>
  
  <pre><code>Pattern p = Pattern.compile("node \\[\n(.*|\n)*?\\]", Pattern.MULTILINE);
  
  Matcher m = p.matcher(text);
  
  while(m.find())
  {
      System.out.println(m.group());
  }
  </code></pre>
  
  <p>Edit text:</p>
  
  <pre><code>    node [\n" +
  "       id 2\n" +
  "       label \"node 2\"\n" +
  "       thisIsASampleAttribute 43\n" +
  "   ]\n" +
  "   node [\n" +
  "       id 3\n" +
  "       label \"node 3\"\n" +
  "       thisIsASampleAttribute 44\n" +
  "   ]\n"
  </code></pre>