$re = '/editor\s*\{[^{}"]*
# Notice that I enabled the /x flag ----->
# That just allows me to add comments here to make it more readable
# Match from opening to closing double quote for the \'key\'
"[^"]*"
# Then any whitespace between the \'key\' and \'value\'
\s+
# Match from opening to closing double quote for the \'value\'
"[^"]*"/x';
$str = '"entity"
{
"id" "5040044"
"classname" "weapon_defibrillator_spawn"
"angles" "0 0 0"
"body" "0"
"disableshadows" "0"
"skin" "0"
"solid" "6"
"spawnflags" "3"
"origin" "449.47 5797.25 2856"
editor
{
"color" "0 0 200"
"visgroupshown" "1"
"visgroupautoshown" "1"
"logicalpos" "[-13268 14500]"
}
editor
{
"color" "0 0 200"
"visgroupshown" "1"
"visgroupautoshown" "1"
"logicalpos" "[-13268 14500]"
"specialchars" "}"
}
editor
{
"child" "0 0 200"
"visgroupshown" "1"
"visgroupautoshown" "1"
"logicalpos" "[-13268 14500]"
subgroup
{
"child" "42 42 42"
}
}
}
';
preg_match_all($re, $str, $matches, PREG_SET_ORDER, 0);
// Print the entire match result
var_dump($matches);
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for PHP, please visit: http://php.net/manual/en/ref.pcre.php