$re = '/"[a-zA-Z0-9]+(-){1}[a-zA-Z0-9]+":/m';
$str = '{
"min-position": 3,
"has-more-items": false,
"items-html": "Bike",
"new-latent-count": 5,
"data": {
"length": 21,
"text": "Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
},
"numerical-Array": [
20,
30,
32,
24,
29
],
"String-Array": [
"Oxygen",
"Carbon",
"Oxygen",
"Nitrogen"
],
"multiple-Types-Array": 5,
"objArray": [
{
"class": "lower",
"age": 2
},
{
"class": "middle",
"age": 0
},
{
"class": "lower",
"age": 5
},
{
"class": "lower",
"age": 6
},
{
"class": "upper",
"age": 1
}
]
}';
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