I'm looking for a PHP regular expression to match a pattern for multiple set of json data in a text string.
Paragraph One text
[[{"fid":"28","view_mode":"teaser","fields":{},"type":"media","attributes":{"class":"media-element file-teaser"},"link_text":null}]]
Second Paragraph
[[{"fid":"26","view_mode":"preview","fields":{},"type":"media","attributes":{"class":"file media-element file-preview"},"link_text":"mohan sample.mp4"}]]
Above is the example text with json samples, i want to extract the value of "fid" from each json data.
Any suggestions?
json_decode()this and read the value directly?json_decode()won't work if it's mixed in with other text. He needs the regexp to find just the single JSON object so he can decode it.