title: Regex to replace parentheses with square bracket
body: <p>I need to convert some variables that use parentheses instead of bracket in a Javascript file. For example, MyVariable(i) should be MyVariable[i].</p>
  
  <p>I use the <strong><em>Find and Replace</em></strong> tool of Visual Studio with this Regex :</p>
  
  <pre><code>MyVariable\({(.+)}\)
  </code></pre>
  
  <p>and replace with:</p>
  
  <pre><code>MyVariable\[\1\]
  </code></pre>
  
  <p>This work fine for case like :</p>
  
  <pre><code>asdas.MyVariable(i+1)
  asdas.MyVariable(i)
  asdas.MyVariable(i).asd
  MyVariable(i+1)
  </code></pre>
  
  <p>But doesn't work for case like </p>
  
  <pre><code>if (parseInt(OtherObject.MyVariable(i+1).Dest.XYZ)==SINK_STATE_TYPE || OtherObject.MyVariable(i).X == "ok")
  </code></pre>
  
  <p>The last one will do take the first parentheses and the last one of the line and act weird. What do I need to change in the Regex to be able to make it works with line that has multiple parentheses.</p>