title: How do I match a nested bracket and brace pair while ignoring single instances using regex?
body: <p>Given lines such as:</p>
  
  <pre><code>[{ ERR }]
   { ABC }
   [ NT1 ]
  
   [ XYZ }  &lt;- This is an illegal form and should also be ignored
  </code></pre>
  
  <p>How do I write a regex that will capture the first segment, but ignore the others if I read line by line. So if there is one nested <em>pair</em> of [] and one <em>pair</em> of {} it will match that, and then not match on the other lines. </p>
  
  <p>I've attempted to do this using the expression <code>([ \[]*([ \{]*[a-zA-Z]+[ \} ]*)[ \] ]*)</code> </p>
  
  <p>I'm also trying to output the three alphanumerics in the center as a match subgroup (there will never be more than three char). Whitespace is irrelevant.</p>