title: Regex that removes everything except specified string
body: <p>I am working with data that looks something like this:</p>
  
  <pre><code>{"score":0,"compare":0,"words":["book","planet","sun","science"],"words":[],"good":[],"bad":[]}
  {"score":-1,"compare":0,"words":["book","planet","sun","science"],"words":[],"good":[],"bad":[]}
  {"score":1,"compare":0,"words":["book","planet","sun","science"],"words":[],"good":[],"bad":[]}
  </code></pre>
  
  <p>The only information that I am interested in is the <strong>"score":#</strong> (which could be either positive or negative).
  Since I am working with thousands of lines that look like above, I am trying to extract only the score information that I am interested in using a <code>regular expression</code>.</p>
  
  <p>I have consulted various posts, such as <a href="https://stackoverflow.com/questions/15852869/find-all-strings-except-one-string-using-regex">here</a>, <a href="https://stackoverflow.com/questions/2404010/match-everything-except-for-specified-strings">here</a> and <a href="http://www.emalis.com/2012/09/replace-select-all-except-a-string-with-regex-and-notepad/" rel="nofollow noreferrer">here</a>, for example, but none of them seem to address my problem.</p>
  
  <p>I have used them to try to write my own regular expression. Thus far, I have tried things such as:</p>
  
  <pre><code>(?!"score":(-)?[0-9])
  
  ^(?!"score":(-)?[0-9].*
  
  (.(?!"score":(-)?[0-9]))*
  </code></pre>
  
  <p>but each of these examples selects <em>ALL</em> of the information, including what I am interested in.</p>
  
  <p>How can I modify these regular expressions to arrive at my desired result, which is:</p>
  
  <pre><code>"score":0
  "score":-1
  "score":1
  </code></pre>