I am working with data that looks something like this:
{"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":[]}
The only information that I am interested in is the "score":# (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 regular expression
.
I have consulted various posts, such as here, here and here, for example, but none of them seem to address my problem.
I have used them to try to write my own regular expression. Thus far, I have tried things such as:
(?!"score":(-)?[0-9])
^(?!"score":(-)?[0-9].*
(.(?!"score":(-)?[0-9]))*
but each of these examples selects ALL of the information, including what I am interested in.
How can I modify these regular expressions to arrive at my desired result, which is:
"score":0
"score":-1
"score":1