title: Get all text between bracket but skip nested bracket Java
body: <p>I'm trying to get all text that is in brackets &quot;test_two&quot;.</p>
  <pre><code>String test = &quot;
      test_one{
       My Text One
      }
      test_two{
       My Text Two
         sub_test_one{
           My Sub Text
          }
         sub_test_two{
           My Sub Text
          }
      }
      test_three{
       My Text Three
      }&quot;
  </code></pre>
  <p>My Code:</p>
  <pre><code>        int testOne = test.indexOf(&quot;test_two&quot;);
          int startTestOne = test.indexOf('{', testOne);
          int endTestOne = test.indexOf('}', testOne);
          String test3_2 = test.substring(startTestOne + 2, endTestOne);
  </code></pre>
  <p>which gives me, but i want whole text from &quot;test_two&quot; brackets</p>
  <pre><code>My Text Two
         sub_test{
           My Sub Text
  </code></pre>