title: Regular expression to return all characters between two special characters
body: <p>How would I go about using regx to return all characters between two brackets.
  Here is an example:</p>
  
  <pre><code>foobar['infoNeededHere']ddd
  needs to return infoNeededHere
  </code></pre>
  
  <p>I found a regex to do it between curly brackets but all attempts at making it work with square brackets have failed. Here is that regex: <code>(?&lt;={)[^}]*(?=})</code> and here is my attempt to hack it</p>
  
  <pre><code>(?&lt;=[)[^}]*(?=])
  </code></pre>
  
  <p><strong>Final Solution:</strong></p>
  
  <pre><code>import re
  
  str = "foobar['InfoNeeded'],"
  match = re.match(r"^.*\['(.*)'\].*$",str)
  print match.group(1)
  </code></pre>