title: Get string inside brackets
body: <p>I want to fetch the string inside the square bracket, which is given as array</p>
  
  <pre><code>u16 arrayName_1[8][7]
  </code></pre>
  
  <p>I have python code which can find the 1-Dimensional array and get the character inside squre brackets.</p>
  
  <pre><code>var = 'u16 arrayName_1[8]'
  index = re.split('\[(.*?)\]', str(var))
  </code></pre>
  
  <p>index[0] will give 'u16 arrayName_1'.</p>
  
  <p>index[1] will give '8'.</p>
  
  <p>Problem:
  I want to get string inside brackets of 2D array. i tried below code but it is not desired result.</p>
  
  <pre><code>var = u16 arrayName_1[8][7]
  index= re.split('(\[.*\])$', str(var))
  </code></pre>
  
  <p>index[0] will give 'u16 arrayName_1'.</p>
  
  <p>index[1] will give '[8][7]'. This is wrong result.</p>
  
  <p>I want output like:</p>
  
  <p>index[1] = '8'</p>
  
  <p>index[2] = '7'</p>