Regex for text between double square brackets in php -


this sample text:

text text text [[{"fid":"3228","view_mode":"full","fields":{"format":"full","field_file_image_alt_text[und][0][value]":"text text text","field_file_image_title_text[und][0][value]":"","field_file_image_gallery_content[und][0][value]":"","field_file_image_gallery_content[und][0][format]":"full_html"},"type":"media","link_text":null,"attributes":{"alt":"text text","height":"647","width":"421","class":"media-element file-full"}}]] 

i want extract text between double brackets: [[ , ]].

this approach:

preg_match_all("/\[[^\]]*\]/", $txt, $matches); 

but works text between singles brackets [ , ].

how regex have like, extract text between double brackets?

you're trying process json data using regular expressions. that's fraught danger.

use json_decode


Comments