title: regex to match line breaks and tabs between brackets
body: <p>I'm trying to remove line breaks and tabs from content that's inside brackets from data like this:</p>
  <pre><code>settings:a [
      a:[
          a:a
          b:b
      ]
      b:[
          a:a
          b:b
      ]
  ]
  
  settings:b [
      a:[
          a:a
          b:b
      ]
  ]
  </code></pre>
  <p>So it becomes:</p>
  <pre><code>settings:a [ a:[ a:a b:b ] b:[ a:a b:b ] ] 
  settings:b [ a:[ a:a b:b ] ]
  </code></pre>
  <p>The regex i'm using <code>\n(?=[^\[\]]*\])</code> works to some extent but I don't get the output like above. Can you help?</p>
  <p><a href="https://regex101.com/r/5bJwx1/1" rel="nofollow noreferrer">Regex Example</a></p>