title: How to extract string from custom characters using JavaScript?
body: <p>If I have a string between 2 square brackets that I have created on a page, how would I go about storing that value in a variable and deleting the square brackets? </p>
  
  <p><strong>Example</strong></p>
  
  <pre><code>[String I want]
  </code></pre>
  
  <p><strong>So I'm left with</strong></p>
  
  <pre><code>var mystring = "String I want"
  </code></pre>
  
  <p><strong>UPDATE: It appears I can't reply to any of you. SO must be acting up. Anyway 
  this is what I am using</strong> </p>
  
  <pre><code>var wholeParagraph = $('.comment-body p');
  
    var rating = wholeParagraph.substring(wholeParagraph.indexOf('['), 1+wholeParagraph.lastIndexOf(']'));
  
    alert(rating);
  </code></pre>
  
  <p>Doesn't seem to work?</p>