title: RegEx to get text from inside the square brackets
body: <blockquote>
  <p><strong>Possible Duplicate:</strong><br />
  <a href="https://stackoverflow.com/questions/1454913/regular-expression-to-find-a-string-included-between-two-characters-while-exclu">Regular Expression to find a string included between two characters, while EXCLUDING the delimiters</a></p>
  </blockquote>
  
  <p>I have a function where I have to get text which is enclosed in square brackets but not brackets for example</p>
  <pre><code>this is [test] line i [want] text [inside] square [brackets]
  </code></pre>
  <p>from the above line I want words:</p>
  <pre><code>test
  want
  inside
  brackets
  </code></pre>
  <p>I am trying with to do this with <code>/\[(.*?)\]/g</code> but I am not getting satisfied result, I get the words inside brackets but also brackets which are not what I want</p>
  <p>I did search for some similar type of question on SO but none of those solution  work properly for me here is one what found <code>(?&lt;=\[)[^]]+(?=\])</code> this works in RegEx coach but not with JavaScript. Here is <a href="https://stackoverflow.com/questions/2403122/regular-expression-to-extract-text-between-square-brackets">reference</a> from where I got this</p>
  <p>here is what I have done so far: <a href="http://jsfiddle.net/5SNLM/" rel="nofollow noreferrer">demo</a></p>
  <p>please help.</p>