I have a list of strings in where each element of the list is in this form:
{"created_at":"Thu Aug 08 20:53:26 +0000 2013","id":365576505679568896,"id_str":"365576505679568896","text":"Who wears it better? #TBT http:\/\/t.co\/vAXNgiRmYo","source":"web"
I am trying to extract some specific parts of each element. I prepared this function:
extract[string_] := StringCases[string, {
"\"created_at\":\"" ~~ Shortest@x__ ~~ "\",\"id\":" :> x,
"\",\"id\":" ~~ Shortest@b__ ~~ ",\"id_str\":\"" :> b,
",\"id_str\":\"" ~~ Shortest@c__ ~~ "\",\"text\":\"" :> c,
"\",\"text\":\"" ~~ Shortest@d__ ~~ "\",\"source\":\"" :> d,
"\",\"source\":\"" ~~ Shortest@e__ ~~ "\",\"truncated\":" :> e
}
]
And then
extract/@listOFelements
But as example for the element above I get this result:
{"Thu Aug 08 20:53:26 +0000 2013", "365576505679568896", "web"}
Some elements like the text flanked by "\",\"text\":\"" and "\",\"source\":\"" are not detected from the string. How should I make it possible to detect it?